2011-02-23 10:52:22 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/*
  
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +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 . 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  The  Original  Code  is  Copyright  ( C )  2001 - 2002  by  NaN  Holding  BV . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  All  rights  reserved . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  Contributor ( s ) :  Blender  Foundation ,  2002 - 2008  full  recode 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  * * * * *  END  GPL  LICENSE  BLOCK  * * * * * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-02-27 20:29:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/** \file blender/editors/object/object_relations.c
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *   \ ingroup  edobj 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  <stdio.h> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  <stdlib.h> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  <string.h> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "MEM_guardedalloc.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "DNA_anim_types.h" 
  
						 
					
						
							
								
									
										
										
										
											2012-02-19 22:17:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "DNA_mesh_types.h" 
  
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "DNA_constraint_types.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "DNA_group_types.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "DNA_lamp_types.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "DNA_lattice_types.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "DNA_material_types.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "DNA_meta_types.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "DNA_particle_types.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "DNA_scene_types.h" 
  
						 
					
						
							
								
									
										
										
										
											2011-08-01 11:44:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "DNA_speaker_types.h" 
  
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "DNA_world_types.h" 
  
						 
					
						
							
								
									
										
										
										
											2010-08-04 04:01:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "DNA_object_types.h" 
  
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BLI_math.h" 
  
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "BLI_listbase.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BLI_string.h" 
  
						 
					
						
							
								
									
										
										
										
											2011-01-07 18:36:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BLI_utildefines.h" 
  
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BKE_action.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BKE_animsys.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BKE_armature.h" 
  
						 
					
						
							
								
									
										
										
										
											2011-11-05 13:00:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_camera.h" 
  
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "BKE_context.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BKE_constraint.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BKE_curve.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BKE_depsgraph.h" 
  
						 
					
						
							
								
									
										
										
										
											2011-11-23 15:44:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_DerivedMesh.h" 
  
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "BKE_displist.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BKE_global.h" 
  
						 
					
						
							
								
									
										
										
										
											2010-10-21 10:28:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_fcurve.h" 
  
						 
					
						
							
								
									
										
										
										
											2011-11-05 13:11:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_lamp.h" 
  
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "BKE_lattice.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BKE_library.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BKE_main.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BKE_material.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BKE_mball.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BKE_mesh.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BKE_modifier.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BKE_object.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BKE_report.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BKE_sca.h" 
  
						 
					
						
							
								
									
										
										
										
											2009-11-04 10:25:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_scene.h" 
  
						 
					
						
							
								
									
										
										
										
											2011-08-04 07:12:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_speaker.h" 
  
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "BKE_texture.h" 
  
						 
					
						
							
								
									
										
										
										
											2010-01-28 00:45:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_tessmesh.h" 
  
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "WM_api.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "WM_types.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "UI_interface.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "UI_resources.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "RNA_access.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "RNA_define.h" 
  
						 
					
						
							
								
									
										
										
										
											2009-11-04 10:25:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "RNA_enum_types.h" 
  
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "ED_armature.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "ED_curve.h" 
  
						 
					
						
							
								
									
										
										
										
											2010-10-21 10:28:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "ED_keyframing.h" 
  
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "ED_object.h" 
  
						 
					
						
							
								
									
										
										
										
											2011-09-21 17:15:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "ED_mesh.h" 
  
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "ED_screen.h" 
  
						 
					
						
							
								
									
										
											 
										
											
												Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
  There are calls to define drag-able images, ID blocks, RNA paths, 
  file paths, and so on. By default you drag an icon, exceptionally 
  an ImBuf
- Drag items are registered centrally in the WM, it allows more drag 
  items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts 
  the mouse event to an EVT_DROP type. This event then gets the full 
  drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps 
  you can make a "drop map" this way, which become 'drop map handlers' 
  in the queues.
- next to that the UI kit handles some common button types (like 
  accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
  - poll() = check if the event drag data is relevant for this box
  - copy() = fill in custom properties in the dropbox to initialize 
    an operator
- The dropbox handler then calls its standard Operator with its 
  dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit 
on mouse-over. In case the icon is a button or UI element too (most 
cases), the drag-able feature will make the item react to 
mouse-release instead of mouse-press. 
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works 
too. I've added code that passes on mousemoves and clicks to other 
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an 
Image ID... keep this in mind. Sequencer for example wants paths to 
be dropped,  textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're 
part of the UI and editor design (= how we want an editor to work), and 
not default offered configurable like keymaps. 
- At the moment only one item can be dragged at a time. This is for 
several reasons.... For one, Blender doesn't have a well defined 
uniform way to define "what is selected" (files, outliner items, etc). 
Secondly there's potential conflicts on what todo when you drop mixed 
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip, 
should be represented in filewindow as a single sequence anyway. 
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it 
could show the operator as a sort of menu, allowing arrow or scrollwheel 
to choose. For time being I'd prefer to try to design a singular drop 
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that 
detects an object (type) under cursor, so a drag item's option can be 
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled, 
while WM event code tried same. Added new OPERATOR_HANDLED flag for this. 
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
  (for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review... 
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS 
into Blender window. I've noticed this code is unfinished for Macs, but 
seems to be complete for Windows. Needs test... currently, an external 
drop event will print in console when succesfully delivered to Blender's WM.
											 
										 
										
											2010-01-26 18:18:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "ED_view3d.h" 
  
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "object_intern.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*********************** Make Vertex Parent Operator ************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  int  vertex_parent_set_poll ( bContext  * C )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  ED_operator_editmesh ( C )  | |  ED_operator_editsurfcurve ( C )  | |  ED_operator_editlattice ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  int  vertex_parent_set_exec ( bContext  * C ,  wmOperator  * op )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Main  * bmain  =  CTX_data_main ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Scene  * scene  =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Object  * obedit  =  CTX_data_edit_object ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-28 00:45:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BMVert  * eve ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BMIter  iter ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									Curve  * cu ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Nurb  * nu ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BezTriple  * bezt ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BPoint  * bp ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Object  * par ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  a ,  v1  =  0 ,  v2  =  0 ,  v3  =  0 ,  v4  =  0 ,  nr  =  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* we need 1 to 3 selected vertices */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( obedit - > type  = =  OB_MESH )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Mesh  * me  =  obedit - > data ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-21 17:15:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BMEditMesh  * em ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 08:25:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-29 01:41:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										EDBM_mesh_load ( obedit ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-27 04:46:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										EDBM_mesh_make ( scene - > toolsettings ,  scene ,  obedit ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 08:25:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										em  =  me - > edit_btmesh ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-11-23 15:44:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* derivedMesh might be needed for solving parenting,
 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-03 16:31:46 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										 *  so  re - create  it  here  */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-23 17:14:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										makeDerivedMesh ( scene ,  obedit ,  em ,  CD_MASK_BAREMESH ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
											
												2.5: Object module
* Split object_edit.c into multiple files:
  object_add.c, object_edit.c, object_hook.c, object_relations.c,
  object_select.c, object_transform.c.
* Rename files to have consistent object_ and mball_ prefix:
  object_shapekey.c, object_lattice.c, object_vgroup.c, mball_edit.c.
* Added operators:
  * vertex group menu and set active
  * apply location, rotation, scale, visual transform (location is new)
  * make local
  * make vertex parent
  * move to layer
  * convert to curve/mesh (not finished yet)
* Many small fixes for marked issues, but still much code to be cleaned
  up here...
											 
										 
										
											2009-09-09 11:52:56 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-19 13:47:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BM_ITER_MESH  ( eve ,  & iter ,  em - > bm ,  BM_VERTS_OF_MESH )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-12 10:51:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( BM_elem_flag_test ( eve ,  BM_ELEM_SELECT ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( v1  = =  0 )  v1  =  nr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												else  if  ( v2  = =  0 )  v2  =  nr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												else  if  ( v3  = =  0 )  v3  =  nr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												else  if  ( v4  = =  0 )  v4  =  nr ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												else  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-06 05:04:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											nr + + ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else  if  ( ELEM ( obedit - > type ,  OB_SURF ,  OB_CURVE ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ListBase  * editnurb  =  object_editcurve_get ( obedit ) ; 
							 
						 
					
						
							
								
									
										
										
											
												2.5: Object module
* Split object_edit.c into multiple files:
  object_add.c, object_edit.c, object_hook.c, object_relations.c,
  object_select.c, object_transform.c.
* Rename files to have consistent object_ and mball_ prefix:
  object_shapekey.c, object_lattice.c, object_vgroup.c, mball_edit.c.
* Added operators:
  * vertex group menu and set active
  * apply location, rotation, scale, visual transform (location is new)
  * make local
  * make vertex parent
  * move to layer
  * convert to curve/mesh (not finished yet)
* Many small fixes for marked issues, but still much code to be cleaned
  up here...
											 
										 
										
											2009-09-09 11:52:56 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										cu  =  obedit - > data ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										nu  =  editnurb - > first ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										while  ( nu )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( nu - > type  = =  CU_BEZIER )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												bezt  =  nu - > bezt ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												a  =  nu - > pntsu ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												while  ( a - - )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( BEZSELECTED_HIDDENHANDLES ( cu ,  bezt ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( v1  = =  0 )  v1  =  nr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														else  if  ( v2  = =  0 )  v2  =  nr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														else  if  ( v3  = =  0 )  v3  =  nr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														else  if  ( v4  = =  0 )  v4  =  nr ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
														else  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													nr + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													bezt + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											else  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												bp  =  nu - > bp ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												a  =  nu - > pntsu  *  nu - > pntsv ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												while  ( a - - )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( bp - > f1  &  SELECT )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( v1  = =  0 )  v1  =  nr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														else  if  ( v2  = =  0 )  v2  =  nr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														else  if  ( v3  = =  0 )  v3  =  nr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														else  if  ( v4  = =  0 )  v4  =  nr ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
														else  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													nr + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													bp + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											nu  =  nu - > next ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else  if  ( obedit - > type  = =  OB_LATTICE )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Lattice  * lt  =  obedit - > data ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-06 01:23:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										a  =  lt - > editlatt - > latt - > pntsu  *  lt - > editlatt - > latt - > pntsv  *  lt - > editlatt - > latt - > pntsw ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bp  =  lt - > editlatt - > latt - > def ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										while  ( a - - )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( bp - > f1  &  SELECT )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( v1  = =  0 )  v1  =  nr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												else  if  ( v2  = =  0 )  v2  =  nr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												else  if  ( v3  = =  0 )  v3  =  nr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												else  if  ( v4  = =  0 )  v4  =  nr ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												else  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											nr + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											bp + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( v4  | |  ! ( ( v1  & &  v2  = =  0  & &  v3  = =  0 )  | |  ( v1  & &  v2  & &  v3 ) )  )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										BKE_report ( op - > reports ,  RPT_ERROR ,  " Select either 1 or 3 vertices to parent to " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-04-30 16:22:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									CTX_DATA_BEGIN  ( C ,  Object  * ,  ob ,  selected_editable_objects ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ob  ! =  obedit )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											ob - > recalc  | =  OB_RECALC_OB  |  OB_RECALC_DATA  |  OB_RECALC_TIME ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											par  =  obedit - > parent ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											while  ( par )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( par  = =  ob )  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												par  =  par - > parent ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( par )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												BKE_report ( op - > reports ,  RPT_ERROR ,  " Loop in parents " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Object  workob ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												ob - > parent  =  BASACT - > object ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( v3 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													ob - > partype  =  PARVERT3 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													ob - > par1  =  v1  -  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													ob - > par2  =  v2  -  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													ob - > par3  =  v3  -  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													/* inverse parent matrix */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													BKE_object_workob_calc_parent ( scene ,  ob ,  & workob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													invert_m4_m4 ( ob - > parentinv ,  workob . obmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												else  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													ob - > partype  =  PARVERT1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													ob - > par1  =  v1  -  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													/* inverse parent matrix */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													BKE_object_workob_calc_parent ( scene ,  ob ,  & workob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													invert_m4_m4 ( ob - > parentinv ,  workob . obmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CTX_DATA_END ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2010-08-01 12:47:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									DAG_scene_sort ( bmain ,  scene ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									WM_event_add_notifier ( C ,  NC_OBJECT ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  OBJECT_OT_vertex_parent_set ( wmOperatorType  * ot )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > name  =  " Make Vertex Parent " ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-10 21:15:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > description  =  " Parent selected objects to the selected vertices " ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > idname  =  " OBJECT_OT_vertex_parent_set " ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > invoke  =  WM_operator_confirm ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ot - > poll  =  vertex_parent_set_poll ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ot - > exec  =  vertex_parent_set_exec ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* flags */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > flag  =  OPTYPE_REGISTER  |  OPTYPE_UNDO ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/********************** Make Proxy Operator *************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* set the object to proxify */  
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  int  make_proxy_invoke ( bContext  * C ,  wmOperator  * op ,  wmEvent  * evt )  
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Scene  * scene  =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Object  * ob  =  ED_object_active_context ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* sanity checks */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! scene  | |  scene - > id . lib  | |  ! ob ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* Get object to work on - use a menu if we need to... */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ob - > dup_group  & &  ob - > dup_group - > id . lib )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* gives menu with list of objects in group */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-15 17:23:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										//proxy_group_objects_menu(C, op, ob, ob->dup_group);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										WM_enum_search_invoke ( C ,  op ,  evt ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  if  ( ob - > id . lib )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiPopupMenu  * pup  =  uiPupMenuBegin ( C ,  " OK? " ,  ICON_QUESTION ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiLayout  * layout  =  uiPupMenuLayout ( pup ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* create operator menu item with relevant properties filled in */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-22 03:30:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemFullO_ptr ( layout ,  op - > type ,  op - > type - > name ,  ICON_NONE ,  NULL ,  WM_OP_EXEC_REGION_WIN ,  UI_ITEM_O_RETURN_PROPS ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* present the menu and be done... */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiPupMenuEnd ( C ,  pup ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* error.. cannot continue */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										BKE_report ( op - > reports ,  RPT_ERROR ,  " Can only make proxy for a referenced object or group " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* this invoke just calls another instance of this operator... */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  int  make_proxy_exec ( bContext  * C ,  wmOperator  * op )  
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Main  * bmain  =  CTX_data_main ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Object  * ob ,  * gob  =  ED_object_active_context ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-16 16:32:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									GroupObject  * go ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Scene  * scene  =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-16 19:41:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-06 18:40:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( gob - > dup_group  ! =  NULL )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										go  =  BLI_findlink ( & gob - > dup_group - > gobject ,  RNA_enum_get ( op - > ptr ,  " object " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ob  =  go - > ob ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-06 18:40:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ob  =  gob ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-16 19:41:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										gob  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ob )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Object  * newob ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Base  * newbase ,  * oldbase  =  BASACT ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										char  name [ MAX_ID_NAME  +  4 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* Add new object for the proxy */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										newob  =  BKE_object_add ( scene ,  OB_EMPTY ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-19 23:10:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BLI_snprintf ( name ,  sizeof ( name ) ,  " %s_proxy " ,  ( ( ID  * ) ( gob  ?  gob  :  ob ) ) - > name  +  2 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-19 23:10:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										rename_id ( & newob - > id ,  name ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* set layers OK */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										newbase  =  BASACT ;     /* BKE_object_add sets active... */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										newbase - > lay  =  oldbase - > lay ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										newob - > lay  =  newbase - > lay ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* remove base, leave user count of object, it gets linked in BKE_object_make_proxy */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( gob  = =  NULL )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											BLI_remlink ( & scene - > base ,  oldbase ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											MEM_freeN ( oldbase ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BKE_object_make_proxy ( newob ,  ob ,  gob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* depsgraph flushes are needed for the new data */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-01 12:47:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										DAG_scene_sort ( bmain ,  scene ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										DAG_id_tag_update ( & newob - > id ,  OB_RECALC_OB  |  OB_RECALC_DATA  |  OB_RECALC_TIME ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										WM_event_add_notifier ( C ,  NC_OBJECT  |  ND_DRAW ,  newob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										BKE_report ( op - > reports ,  RPT_ERROR ,  " No object to make proxy for " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-01-15 17:23:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* Generic itemf's for operators that take library args */  
						 
					
						
							
								
									
										
										
										
											2011-05-26 13:38:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  EnumPropertyItem  * proxy_group_object_itemf ( bContext  * C ,  PointerRNA  * UNUSED ( ptr ) ,  PropertyRNA  * UNUSED ( prop ) ,  int  * free )  
						 
					
						
							
								
									
										
										
										
											2010-01-15 17:23:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									EnumPropertyItem  item_tmp  =  { 0 } ,  * item  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  totitem  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  i  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Object  * ob  =  ED_object_active_context ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-15 17:23:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									GroupObject  * go ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! ob  | |  ! ob - > dup_group ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-27 21:19:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  DummyRNA_DEFAULT_items ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-15 17:23:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* find the object to affect */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( go  =  ob - > dup_group - > gobject . first ;  go ;  go  =  go - > next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										item_tmp . identifier  =  item_tmp . name  =  go - > ob - > id . name  +  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										item_tmp . value  =  i + + ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-15 17:23:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										RNA_enum_item_add ( & item ,  & totitem ,  & item_tmp ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									RNA_enum_item_end ( & item ,  & totitem ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									* free  =  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-15 17:23:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  item ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  OBJECT_OT_proxy_make ( wmOperatorType  * ot )  
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2010-01-15 17:23:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									PropertyRNA  * prop ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > name  =  " Make Proxy " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ot - > idname  =  " OBJECT_OT_proxy_make " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ot - > description  =  " Add empty object to become local replacement data of a library-linked object " ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* callbacks */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > invoke  =  make_proxy_invoke ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ot - > exec  =  make_proxy_exec ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ot - > poll  =  ED_operator_object_active ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* flags */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > flag  =  OPTYPE_REGISTER  |  OPTYPE_UNDO ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* properties */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									prop  =  RNA_def_enum ( ot - > srna ,  " object " ,  DummyRNA_DEFAULT_items ,  0 ,  " Proxy Object " ,  " Name of lib-linked/grouped object to make a proxy for " ) ;  /* XXX, relies on hard coded ID at the moment */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-15 17:23:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									RNA_def_enum_funcs ( prop ,  proxy_group_object_itemf ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > prop  =  prop ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/********************** Clear Parent Operator ******************* */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-01-22 10:20:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								EnumPropertyItem  prop_clear_parent_types [ ]  =  {  
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									{ 0 ,  " CLEAR " ,  0 ,  " Clear Parent " ,  " " } , 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-26 02:57:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									{ 1 ,  " CLEAR_KEEP_TRANSFORM " ,  0 ,  " Clear and Keep Transformation " ,  " " } , 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									{ 2 ,  " CLEAR_INVERSE " ,  0 ,  " Clear Parent Inverse " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 0 ,  NULL ,  0 ,  NULL ,  NULL } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-29 18:12:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ED_object_parent_clear ( Object  * ob ,  int  type )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ob - > parent  = =  NULL ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( type  = =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ob - > parent  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  if  ( type  = =  1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ob - > parent  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										BKE_object_apply_mat4 ( ob ,  ob - > obmat ,  TRUE ,  FALSE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  if  ( type  = =  2 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										unit_m4 ( ob - > parentinv ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ob - > recalc  | =  OB_RECALC_OB  |  OB_RECALC_DATA  |  OB_RECALC_TIME ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* note, poll should check for editable scene */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  int  parent_clear_exec ( bContext  * C ,  wmOperator  * op )  
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Main  * bmain  =  CTX_data_main ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Scene  * scene  =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-29 18:12:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  type  =  RNA_enum_get ( op - > ptr ,  " type " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-30 16:22:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									CTX_DATA_BEGIN  ( C ,  Object  * ,  ob ,  selected_editable_objects ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-29 18:12:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ED_object_parent_clear ( ob ,  type ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CTX_DATA_END ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-22 10:20:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-08-01 12:47:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									DAG_scene_sort ( bmain ,  scene ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									DAG_ids_flush_update ( bmain ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									WM_event_add_notifier ( C ,  NC_OBJECT  |  ND_TRANSFORM ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									WM_event_add_notifier ( C ,  NC_OBJECT  |  ND_PARENT ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  OBJECT_OT_parent_clear ( wmOperatorType  * ot )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > name  =  " Clear Parent " ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-10 21:15:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > description  =  " Clear the object's parenting " ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > idname  =  " OBJECT_OT_parent_clear " ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > invoke  =  WM_menu_invoke ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ot - > exec  =  parent_clear_exec ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > poll  =  ED_operator_object_active_editable ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* flags */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > flag  =  OPTYPE_REGISTER  |  OPTYPE_UNDO ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > prop  =  RNA_def_enum ( ot - > srna ,  " type " ,  prop_clear_parent_types ,  0 ,  " Type " ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* ******************** Make Parent Operator *********************** */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  ED_object_parent ( Object  * ob ,  Object  * par ,  int  type ,  const  char  * substr )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2011-12-16 10:39:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! par  | |  BKE_object_parent_loop_check ( par ,  ob ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ob - > parent  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ob - > partype  =  PAROBJECT ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ob - > parsubstr [ 0 ]  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* this could use some more checks */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ob - > parent  =  par ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									ob - > partype  & =  ~ PARTYPE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ob - > partype  | =  type ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BLI_strncpy ( ob - > parsubstr ,  substr ,  sizeof ( ob - > parsubstr ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-01-22 10:20:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* Operator Property */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								EnumPropertyItem  prop_make_parent_types [ ]  =  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ PAR_OBJECT ,  " OBJECT " ,  0 ,  " Object " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ PAR_ARMATURE ,  " ARMATURE " ,  0 ,  " Armature Deform " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ PAR_ARMATURE_NAME ,  " ARMATURE_NAME " ,  0 ,  "    With Empty Groups " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ PAR_ARMATURE_AUTO ,  " ARMATURE_AUTO " ,  0 ,  "    With Automatic Weights " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ PAR_ARMATURE_ENVELOPE ,  " ARMATURE_ENVELOPE " ,  0 ,  "    With Envelope Weights " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ PAR_BONE ,  " BONE " ,  0 ,  " Bone " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ PAR_CURVE ,  " CURVE " ,  0 ,  " Curve Deform " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ PAR_FOLLOW ,  " FOLLOW " ,  0 ,  " Follow Path " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ PAR_PATH_CONST ,  " PATH_CONST " ,  0 ,  " Path Constraint " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ PAR_LATTICE ,  " LATTICE " ,  0 ,  " Lattice Deform " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ PAR_VERTEX ,  " VERTEX " ,  0 ,  " Vertex " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ PAR_TRIA ,  " TRIA " ,  0 ,  " Triangle " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 0 ,  NULL ,  0 ,  NULL ,  NULL } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-22 07:56:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								int  ED_object_parent_set ( ReportList  * reports ,  Main  * bmain ,  Scene  * scene ,  Object  * ob ,  Object  * par ,  int  partype )  
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bPoseChannel  * pchan  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  pararm  =  ELEM4 ( partype ,  PAR_ARMATURE ,  PAR_ARMATURE_NAME ,  PAR_ARMATURE_ENVELOPE ,  PAR_ARMATURE_AUTO ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									par - > recalc  | =  OB_RECALC_OB ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* preconditions */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( partype  = =  PAR_FOLLOW  | |  partype  = =  PAR_PATH_CONST )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( par - > type  ! =  OB_CURVE ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-22 10:20:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										else  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Curve  * cu  =  par - > data ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( ( cu - > flag  &  CU_PATH )  = =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												cu - > flag  | =  CU_PATH  |  CU_FOLLOW ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-07 06:58:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												BKE_displist_make_curveTypes ( scene ,  par ,  0 ) ;   /* force creation of path data */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											else  cu - > flag  | =  CU_FOLLOW ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
									
										
										
										
											2010-10-21 10:28:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											/* if follow, add F-Curve for ctime (i.e. "eval_time") so that path-follow works */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( partype  = =  PAR_FOLLOW )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-21 10:28:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												/* get or create F-Curve */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												bAction  * act  =  verify_adt_action ( & cu - > id ,  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-01 13:54:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												FCurve  * fcu  =  verify_fcurve ( act ,  NULL ,  NULL ,  " eval_time " ,  0 ,  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-21 10:28:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
									
										
										
										
											2012-03-01 12:20:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												/* setup dummy 'generator' modifier here to get 1-1 correspondence still working */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-21 10:28:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( ! fcu - > bezt  & &  ! fcu - > fpt  & &  ! fcu - > modifiers . first ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													add_fmodifier ( & fcu - > modifiers ,  FMODIFIER_TYPE_GENERATOR ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
									
										
										
										
											2009-10-22 23:22:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											/* fall back on regular parenting now (for follow only) */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( partype  = =  PAR_FOLLOW ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												partype  =  PAR_OBJECT ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 		
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else  if  ( partype  = =  PAR_BONE )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 16:03:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										pchan  =  BKE_pose_channel_active ( par ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( pchan  = =  NULL )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-22 07:56:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											BKE_report ( reports ,  RPT_ERROR ,  " No active Bone " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-22 10:20:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ob  ! =  par )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-22 07:56:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( BKE_object_parent_loop_check ( par ,  ob ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											BKE_report ( reports ,  RPT_ERROR ,  " Loop in parents " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Object  workob ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* apply transformation of previous parenting */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											/* BKE_object_apply_mat4(ob, ob->obmat); */  /* removed because of bug [#23577] */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-22 07:56:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* set the parent (except for follow-path constraint option) */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( partype  ! =  PAR_PATH_CONST )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												ob - > parent  =  par ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-22 07:56:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* handle types */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( pchan ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												BLI_strncpy ( ob - > parsubstr ,  pchan - > name ,  sizeof ( ob - > parsubstr ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											else 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												ob - > parsubstr [ 0 ]  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-22 10:20:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
									
										
										
										
											2012-02-22 07:56:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( partype  = =  PAR_PATH_CONST )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												/* don't do anything here, since this is not technically "parenting" */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-07 04:53:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											else  if  ( ELEM ( partype ,  PAR_CURVE ,  PAR_LATTICE )  | |  ( pararm ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-22 07:56:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												/* partype is now set to PAROBJECT so that invisible 'virtual' modifiers don't need to be created
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												 *  NOTE :  the  old  ( 2.4 x )  method  was  to  set  ob - > partype  =  PARSKEL ,  creating  the  virtual  modifiers 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												 */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												ob - > partype  =  PAROBJECT ;  /* note, dna define, not operator property */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-22 07:56:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												//ob->partype= PARSKEL; /* note, dna define, not operator property */
 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
									
										
										
										
											2012-02-22 07:56:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												/* BUT, to keep the deforms, we need a modifier, and then we need to set the object that it uses */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												// XXX currently this should only happen for meshes, curves, surfaces, and lattices - this stuff isn't available for metas yet
 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-06 18:40:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( ELEM5 ( ob - > type ,  OB_MESH ,  OB_CURVE ,  OB_SURF ,  OB_FONT ,  OB_LATTICE ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-22 07:56:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													ModifierData  * md ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-22 12:28:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													
							 
						 
					
						
							
								
									
										
										
										
											2012-02-22 07:56:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													switch  ( partype )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														case  PAR_CURVE :  /* curve deform */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															md  =  ED_object_modifier_add ( reports ,  bmain ,  scene ,  ob ,  NULL ,  eModifierType_Curve ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															( ( CurveModifierData  * ) md ) - > object  =  par ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														case  PAR_LATTICE :  /* lattice deform */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															md  =  ED_object_modifier_add ( reports ,  bmain ,  scene ,  ob ,  NULL ,  eModifierType_Lattice ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															( ( LatticeModifierData  * ) md ) - > object  =  par ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														default :  /* armature deform */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															md  =  ED_object_modifier_add ( reports ,  bmain ,  scene ,  ob ,  NULL ,  eModifierType_Armature ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															( ( ArmatureModifierData  * ) md ) - > object  =  par ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															break ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-22 12:28:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-22 07:56:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											else  if  ( partype  = =  PAR_BONE ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												ob - > partype  =  PARBONE ;   /* note, dna define, not operator property */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-22 07:56:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											else 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												ob - > partype  =  PAROBJECT ;   /* note, dna define, not operator property */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-22 07:56:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* constraint */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( partype  = =  PAR_PATH_CONST )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-22 07:56:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												bConstraint  * con ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												bFollowPathConstraint  * data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												float  cmat [ 4 ] [ 4 ] ,  vec [ 3 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
									
										
										
										
											2012-02-22 07:56:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												con  =  add_ob_constraint ( ob ,  " AutoPath " ,  CONSTRAINT_TYPE_FOLLOWPATH ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												data  =  con - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												data - > tar  =  par ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												get_constraint_target_matrix ( scene ,  con ,  0 ,  CONSTRAINT_OBTYPE_OBJECT ,  NULL ,  cmat ,  scene - > r . cfra ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												sub_v3_v3v3 ( vec ,  ob - > obmat [ 3 ] ,  cmat [ 3 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												ob - > loc [ 0 ]  =  vec [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												ob - > loc [ 1 ]  =  vec [ 1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												ob - > loc [ 2 ]  =  vec [ 2 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											else  if  ( pararm  & &  ob - > type  = =  OB_MESH  & &  par - > type  = =  OB_ARMATURE )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( partype  = =  PAR_ARMATURE_NAME ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-22 07:56:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													create_vgroups_from_armature ( reports ,  scene ,  ob ,  par ,  ARM_GROUPS_NAME ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												else  if  ( partype  = =  PAR_ARMATURE_ENVELOPE ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-22 07:56:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													create_vgroups_from_armature ( reports ,  scene ,  ob ,  par ,  ARM_GROUPS_ENVELOPE ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												else  if  ( partype  = =  PAR_ARMATURE_AUTO )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-22 07:56:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													WM_cursor_wait ( 1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													create_vgroups_from_armature ( reports ,  scene ,  ob ,  par ,  ARM_GROUPS_AUTO ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													WM_cursor_wait ( 0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-22 07:56:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												/* get corrected inverse */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												ob - > partype  =  PAROBJECT ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												BKE_object_workob_calc_parent ( scene ,  ob ,  & workob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
									
										
										
										
											2012-02-22 07:56:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												invert_m4_m4 ( ob - > parentinv ,  workob . obmat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												/* calculate inverse parent matrix */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												BKE_object_workob_calc_parent ( scene ,  ob ,  & workob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-22 07:56:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												invert_m4_m4 ( ob - > parentinv ,  workob . obmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-22 07:56:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											ob - > recalc  | =  OB_RECALC_OB  |  OB_RECALC_DATA ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-22 10:20:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  int  parent_set_exec ( bContext  * C ,  wmOperator  * op )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Main  * bmain  =  CTX_data_main ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Scene  * scene  =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Object  * par  =  ED_object_active_context ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  partype  =  RNA_enum_get ( op - > ptr ,  " type " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-22 07:56:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  ok  =  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-22 10:20:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-30 16:22:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									CTX_DATA_BEGIN  ( C ,  Object  * ,  ob ,  selected_editable_objects ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-22 07:56:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ! ED_object_parent_set ( op - > reports ,  bmain ,  scene ,  ob ,  par ,  partype ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											ok  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CTX_DATA_END ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! ok ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-22 10:20:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-22 07:56:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									DAG_scene_sort ( bmain ,  scene ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									DAG_ids_flush_update ( bmain ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									WM_event_add_notifier ( C ,  NC_OBJECT  |  ND_TRANSFORM ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									WM_event_add_notifier ( C ,  NC_OBJECT  |  ND_PARENT ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-22 07:56:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-01-22 10:20:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-10-15 01:36:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  int  parent_set_invoke ( bContext  * C ,  wmOperator  * UNUSED ( op ) ,  wmEvent  * UNUSED ( event ) )  
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Object  * ob  =  ED_object_active_context ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiPopupMenu  * pup  =  uiPupMenuBegin ( C ,  " Set Parent To " ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiLayout  * layout  =  uiPupMenuLayout ( pup ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiLayoutSetOperatorContext ( layout ,  WM_OP_EXEC_DEFAULT ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 15:25:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiItemEnumO ( layout ,  " OBJECT_OT_parent_set " ,  NULL ,  0 ,  " type " ,  PAR_OBJECT ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* ob becomes parent, make the associated menus */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ob - > type  = =  OB_ARMATURE )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 15:25:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemEnumO ( layout ,  " OBJECT_OT_parent_set " ,  NULL ,  0 ,  " type " ,  PAR_ARMATURE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiItemEnumO ( layout ,  " OBJECT_OT_parent_set " ,  NULL ,  0 ,  " type " ,  PAR_ARMATURE_NAME ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiItemEnumO ( layout ,  " OBJECT_OT_parent_set " ,  NULL ,  0 ,  " type " ,  PAR_ARMATURE_ENVELOPE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiItemEnumO ( layout ,  " OBJECT_OT_parent_set " ,  NULL ,  0 ,  " type " ,  PAR_ARMATURE_AUTO ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiItemEnumO ( layout ,  " OBJECT_OT_parent_set " ,  NULL ,  0 ,  " type " ,  PAR_BONE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else  if  ( ob - > type  = =  OB_CURVE )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 15:25:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemEnumO ( layout ,  " OBJECT_OT_parent_set " ,  NULL ,  0 ,  " type " ,  PAR_CURVE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiItemEnumO ( layout ,  " OBJECT_OT_parent_set " ,  NULL ,  0 ,  " type " ,  PAR_FOLLOW ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiItemEnumO ( layout ,  " OBJECT_OT_parent_set " ,  NULL ,  0 ,  " type " ,  PAR_PATH_CONST ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else  if  ( ob - > type  = =  OB_LATTICE )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 15:25:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemEnumO ( layout ,  " OBJECT_OT_parent_set " ,  NULL ,  0 ,  " type " ,  PAR_LATTICE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiPupMenuEnd ( C ,  pup ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  OBJECT_OT_parent_set ( wmOperatorType  * ot )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > name  =  " Make Parent " ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-10 21:15:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > description  =  " Set the object's parenting " ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > idname  =  " OBJECT_OT_parent_set " ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > invoke  =  parent_set_invoke ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ot - > exec  =  parent_set_exec ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > poll  =  ED_operator_object_active ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* flags */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > flag  =  OPTYPE_REGISTER  |  OPTYPE_UNDO ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									RNA_def_enum ( ot - > srna ,  " type " ,  prop_make_parent_types ,  0 ,  " Type " ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-26 11:20:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* ************ Make Parent Without Inverse Operator ******************* */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  int  parent_noinv_set_exec ( bContext  * C ,  wmOperator  * op )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Main  * bmain  =  CTX_data_main ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Object  * par  =  ED_object_active_context ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-26 11:20:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									par - > recalc  | =  OB_RECALC_OB ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2011-01-02 19:00:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* context iterator */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-30 16:22:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									CTX_DATA_BEGIN  ( C ,  Object  * ,  ob ,  selected_editable_objects ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-26 11:20:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ob  ! =  par )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-16 10:39:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( BKE_object_parent_loop_check ( par ,  ob ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-26 11:20:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												BKE_report ( op - > reports ,  RPT_ERROR ,  " Loop in parents " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												/* clear inverse matrix and also the object location */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												unit_m4 ( ob - > parentinv ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												memset ( ob - > loc ,  0 ,  3  *  sizeof ( float ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-26 11:20:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												/* set recalc flags */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												ob - > recalc  | =  OB_RECALC_OB  |  OB_RECALC_DATA ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-26 11:20:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												/* set parenting type for object - object only... */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												ob - > parent  =  par ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												ob - > partype  =  PAROBJECT ;  /* note, dna define, not operator property */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-26 11:20:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CTX_DATA_END ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2010-08-01 12:47:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									DAG_scene_sort ( bmain ,  CTX_data_scene ( C ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									DAG_ids_flush_update ( bmain ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									WM_event_add_notifier ( C ,  NC_OBJECT  |  ND_TRANSFORM ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-26 11:20:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  OBJECT_OT_parent_no_inverse_set ( wmOperatorType  * ot )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > name  =  " Make Parent without Inverse " ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-10 21:15:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > description  =  " Set the object's parenting without setting the inverse parent correction " ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > idname  =  " OBJECT_OT_parent_no_inverse_set " ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-26 11:20:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > invoke  =  WM_operator_confirm ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ot - > exec  =  parent_noinv_set_exec ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ot - > poll  =  ED_operator_object_active_editable ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-26 11:20:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* flags */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > flag  =  OPTYPE_REGISTER  |  OPTYPE_UNDO ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-26 11:20:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								/************************ Clear Slow Parent Operator *********************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-10-15 01:36:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  int  object_slow_parent_clear_exec ( bContext  * C ,  wmOperator  * UNUSED ( op ) )  
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Main  * bmain  =  CTX_data_main ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Scene  * scene  =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-30 16:22:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									CTX_DATA_BEGIN  ( C ,  Object  * ,  ob ,  selected_editable_objects ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ob - > parent )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( ob - > partype  &  PARSLOW )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												ob - > partype  - =  PARSLOW ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												BKE_object_where_is_calc ( scene ,  ob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												ob - > partype  | =  PARSLOW ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												ob - > recalc  | =  OB_RECALC_OB ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CTX_DATA_END ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-08-01 12:47:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									DAG_ids_flush_update ( bmain ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									WM_event_add_notifier ( C ,  NC_SCENE ,  scene ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  OBJECT_OT_slow_parent_clear ( wmOperatorType  * ot )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > name  =  " Clear Slow Parent " ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-10 21:15:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > description  =  " Clear the object's slow parent " ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > idname  =  " OBJECT_OT_slow_parent_clear " ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > invoke  =  WM_operator_confirm ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ot - > exec  =  object_slow_parent_clear_exec ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ot - > poll  =  ED_operator_view3d_active ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* flags */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > flag  =  OPTYPE_REGISTER  |  OPTYPE_UNDO ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/********************** Make Slow Parent Operator *********************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-10-15 01:36:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  int  object_slow_parent_set_exec ( bContext  * C ,  wmOperator  * UNUSED ( op ) )  
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Main  * bmain  =  CTX_data_main ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Scene  * scene  =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-30 16:22:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									CTX_DATA_BEGIN  ( C ,  Object  * ,  ob ,  selected_editable_objects ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ob - > parent ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											ob - > partype  | =  PARSLOW ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ob - > recalc  | =  OB_RECALC_OB ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CTX_DATA_END ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-08-01 12:47:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									DAG_ids_flush_update ( bmain ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									WM_event_add_notifier ( C ,  NC_SCENE ,  scene ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  OBJECT_OT_slow_parent_set ( wmOperatorType  * ot )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > name  =  " Set Slow Parent " ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-10 21:15:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > description  =  " Set the object's slow parent " ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > idname  =  " OBJECT_OT_slow_parent_set " ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > invoke  =  WM_operator_confirm ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ot - > exec  =  object_slow_parent_set_exec ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ot - > poll  =  ED_operator_view3d_active ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* flags */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > flag  =  OPTYPE_REGISTER  |  OPTYPE_UNDO ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* ******************** Clear Track Operator ******************* */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  EnumPropertyItem  prop_clear_track_types [ ]  =  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 0 ,  " CLEAR " ,  0 ,  " Clear Track " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 1 ,  " CLEAR_KEEP_TRANSFORM " ,  0 ,  " Clear and Keep Transformation (Clear Track) " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 0 ,  NULL ,  0 ,  NULL ,  NULL } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* note, poll should check for editable scene */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  int  object_track_clear_exec ( bContext  * C ,  wmOperator  * op )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Main  * bmain  =  CTX_data_main ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Scene  * scene  =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  type  =  RNA_enum_get ( op - > ptr ,  " type " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( CTX_data_edit_object ( C ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										BKE_report ( op - > reports ,  RPT_ERROR ,  " Operation cannot be performed in EditMode " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-30 16:22:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									CTX_DATA_BEGIN  ( C ,  Object  * ,  ob ,  selected_editable_objects ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-21 11:42:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										bConstraint  * con ,  * pcon ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2010-02-21 11:05:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* remove track-object for old track */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ob - > track  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ob - > recalc  | =  OB_RECALC_OB  |  OB_RECALC_DATA  |  OB_RECALC_TIME ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2010-02-21 11:42:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* also remove all tracking constraints */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										for  ( con  =  ob - > constraints . last ;  con ;  con  =  pcon )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											pcon  =  con - > prev ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-21 11:42:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( ELEM3 ( con - > type ,  CONSTRAINT_TYPE_TRACKTO ,  CONSTRAINT_TYPE_LOCKTRACK ,  CONSTRAINT_TYPE_DAMPTRACK ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												remove_constraint ( & ob - > constraints ,  con ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-21 11:05:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( type  = =  1 ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											BKE_object_apply_mat4 ( ob ,  ob - > obmat ,  TRUE ,  TRUE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CTX_DATA_END ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-08-01 12:47:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									DAG_ids_flush_update ( bmain ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									DAG_scene_sort ( bmain ,  scene ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									WM_event_add_notifier ( C ,  NC_OBJECT  |  ND_TRANSFORM ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  OBJECT_OT_track_clear ( wmOperatorType  * ot )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > name  =  " Clear track " ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-10 21:15:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > description  =  " Clear tracking constraint or flag from object " ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > idname  =  " OBJECT_OT_track_clear " ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > invoke  =  WM_menu_invoke ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ot - > exec  =  object_track_clear_exec ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > poll  =  ED_operator_objectmode ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* flags */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > flag  =  OPTYPE_REGISTER  |  OPTYPE_UNDO ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > prop  =  RNA_def_enum ( ot - > srna ,  " type " ,  prop_clear_track_types ,  0 ,  " Type " ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/************************** Make Track Operator *****************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  EnumPropertyItem  prop_make_track_types [ ]  =  {  
						 
					
						
							
								
									
										
										
										
											2010-02-21 11:42:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									{ 1 ,  " DAMPTRACK " ,  0 ,  " Damped Track Constraint " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 2 ,  " TRACKTO " ,  0 ,  " Track To Constraint " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 3 ,  " LOCKTRACK " ,  0 ,  " Lock Track Constraint " ,  " " } , 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									{ 0 ,  NULL ,  0 ,  NULL ,  NULL } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  int  track_set_exec ( bContext  * C ,  wmOperator  * op )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Main  * bmain  =  CTX_data_main ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Scene  * scene  =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Object  * obact  =  ED_object_active_context ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-29 09:14:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  type  =  RNA_enum_get ( op - > ptr ,  " type " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-09 02:45:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( type  = =  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-21 11:42:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										bConstraint  * con ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bDampTrackConstraint  * data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-30 16:22:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										CTX_DATA_BEGIN  ( C ,  Object  * ,  ob ,  selected_editable_objects ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( ob  ! =  obact )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-21 11:42:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												con  =  add_ob_constraint ( ob ,  " AutoTrack " ,  CONSTRAINT_TYPE_DAMPTRACK ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												data  =  con - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												data - > tar  =  obact ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												ob - > recalc  | =  OB_RECALC_OB  |  OB_RECALC_DATA  |  OB_RECALC_TIME ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-21 11:42:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
									
										
										
										
											2011-08-01 11:44:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												/* Lamp, Camera and Speaker track differently by default */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( ob - > type  = =  OB_LAMP  | |  ob - > type  = =  OB_CAMERA  | |  ob - > type  = =  OB_SPEAKER ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-21 11:42:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													data - > trackflag  =  TRACK_nZ ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										CTX_DATA_END ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else  if  ( type  = =  2 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										bConstraint  * con ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bTrackToConstraint  * data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-30 16:22:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										CTX_DATA_BEGIN  ( C ,  Object  * ,  ob ,  selected_editable_objects ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( ob  ! =  obact )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-11 19:58:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												con  =  add_ob_constraint ( ob ,  " AutoTrack " ,  CONSTRAINT_TYPE_TRACKTO ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												data  =  con - > data ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-29 09:14:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												data - > tar  =  obact ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												ob - > recalc  | =  OB_RECALC_OB  |  OB_RECALC_DATA  |  OB_RECALC_TIME ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
									
										
										
										
											2011-08-01 11:44:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												/* Lamp, Camera and Speaker track differently by default */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( ob - > type  = =  OB_LAMP  | |  ob - > type  = =  OB_CAMERA  | |  ob - > type  = =  OB_SPEAKER )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													data - > reserved1  =  TRACK_nZ ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													data - > reserved2  =  UP_Y ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										CTX_DATA_END ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else  if  ( type  = =  3 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										bConstraint  * con ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bLockTrackConstraint  * data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-30 16:22:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										CTX_DATA_BEGIN  ( C ,  Object  * ,  ob ,  selected_editable_objects ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( ob  ! =  obact )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-11 19:58:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												con  =  add_ob_constraint ( ob ,  " AutoTrack " ,  CONSTRAINT_TYPE_LOCKTRACK ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												data  =  con - > data ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-29 09:14:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												data - > tar  =  obact ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												ob - > recalc  | =  OB_RECALC_OB  |  OB_RECALC_DATA  |  OB_RECALC_TIME ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
									
										
										
										
											2011-08-01 11:44:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												/* Lamp, Camera and Speaker track differently by default */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( ob - > type  = =  OB_LAMP  | |  ob - > type  = =  OB_CAMERA  | |  ob - > type  = =  OB_SPEAKER )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													data - > trackflag  =  TRACK_nZ ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													data - > lockflag  =  LOCK_Y ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										CTX_DATA_END ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-21 11:05:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2010-08-01 12:47:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									DAG_scene_sort ( bmain ,  scene ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									DAG_ids_flush_update ( bmain ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									WM_event_add_notifier ( C ,  NC_OBJECT  |  ND_TRANSFORM ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  OBJECT_OT_track_set ( wmOperatorType  * ot )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > name  =  " Make Track " ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-10 21:15:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > description  =  " Make the object track another object, either by constraint or old way or locked track " ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > idname  =  " OBJECT_OT_track_set " ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > invoke  =  WM_menu_invoke ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ot - > exec  =  track_set_exec ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > poll  =  ED_operator_objectmode ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* flags */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > flag  =  OPTYPE_REGISTER  |  OPTYPE_UNDO ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* properties */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > prop  =  RNA_def_enum ( ot - > srna ,  " type " ,  prop_make_track_types ,  0 ,  " Type " ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/************************** Move to Layer Operator *****************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  unsigned  int  move_to_layer_init ( bContext  * C ,  wmOperator  * op )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  values [ 20 ] ,  a ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									unsigned  int  lay  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! RNA_struct_property_is_set ( op - > ptr ,  " layers " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-22 15:34:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* note: layers are set in bases, library objects work for this */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-30 16:22:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										CTX_DATA_BEGIN  ( C ,  Base  * ,  base ,  selected_bases ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											lay  | =  base - > lay ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										CTX_DATA_END ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										for  ( a  =  0 ;  a  <  20 ;  a + + ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											values [ a ]  =  ( lay  &  ( 1  < <  a ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2010-08-18 07:45:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										RNA_boolean_set_array ( op - > ptr ,  " layers " ,  values ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-18 07:45:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										RNA_boolean_get_array ( op - > ptr ,  " layers " ,  values ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										for  ( a  =  0 ;  a  <  20 ;  a + + ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( values [ a ] ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												lay  | =  ( 1  < <  a ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  lay ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  int  move_to_layer_invoke ( bContext  * C ,  wmOperator  * op ,  wmEvent  * event )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									View3D  * v3d  =  CTX_wm_view3d ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( v3d  & &  v3d - > localvd )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-22 23:22:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  WM_operator_confirm_message ( C ,  op ,  " Move from localview " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										move_to_layer_init ( C ,  op ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  WM_operator_props_popup ( C ,  op ,  event ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  int  move_to_layer_exec ( bContext  * C ,  wmOperator  * op )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Main  * bmain  =  CTX_data_main ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Scene  * scene  =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									View3D  * v3d  =  CTX_wm_view3d ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									unsigned  int  lay ,  local ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-19 13:28:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* int is_lamp = FALSE; */  /* UNUSED */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									lay  =  move_to_layer_init ( C ,  op ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									lay  & =  0xFFFFFF ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( lay  = =  0 )  return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( v3d  & &  v3d - > localvd )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										/* now we can move out of localview. */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-22 15:34:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* note: layers are set in bases, library objects work for this */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-30 16:22:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										CTX_DATA_BEGIN  ( C ,  Base  * ,  base ,  selected_bases ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											lay  =  base - > lay  &  ~ v3d - > lay ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											base - > lay  =  lay ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											base - > object - > lay  =  lay ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											base - > object - > flag  & =  ~ SELECT ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											base - > flag  & =  ~ SELECT ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-19 13:28:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											/* if (base->object->type==OB_LAMP) is_lamp = TRUE; */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										CTX_DATA_END ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* normal non localview operation */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-22 15:34:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* note: layers are set in bases, library objects work for this */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-30 16:22:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										CTX_DATA_BEGIN  ( C ,  Base  * ,  base ,  selected_bases ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											/* upper byte is used for local view */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											local  =  base - > lay  &  0xFF000000 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											base - > lay  =  lay  +  local ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											base - > object - > lay  =  lay ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-19 13:28:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											/* if (base->object->type==OB_LAMP) is_lamp = TRUE; */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										CTX_DATA_END ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* warning, active object may be hidden now */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									WM_event_add_notifier ( C ,  NC_OBJECT  |  ND_DRAW ,  scene ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									WM_event_add_notifier ( C ,  NC_SCENE  |  ND_LAYER_CONTENT ,  scene ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-28 07:07:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-08-01 12:47:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									DAG_scene_sort ( bmain ,  scene ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  OBJECT_OT_move_to_layer ( wmOperatorType  * ot )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > name  =  " Move to Layer " ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-10 21:15:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > description  =  " Move the object to different layers " ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > idname  =  " OBJECT_OT_move_to_layer " ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > invoke  =  move_to_layer_invoke ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ot - > exec  =  move_to_layer_exec ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ot - > poll  =  ED_operator_objectmode ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* flags */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > flag  =  OPTYPE_REGISTER  |  OPTYPE_UNDO ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* properties */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-18 07:45:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									RNA_def_boolean_layer_member ( ot - > srna ,  " layers " ,  20 ,  NULL ,  " Layer " ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/************************** Link to Scene Operator *****************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								#if 0 
  
						 
					
						
							
								
									
										
										
										
											2011-02-14 17:55:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  link_to_scene ( Main  * UNUSED ( bmain ) ,  unsigned  short  UNUSED ( nr ) )  
						 
					
						
							
								
									
										
										
											
												2.5: Object module
* Split object_edit.c into multiple files:
  object_add.c, object_edit.c, object_hook.c, object_relations.c,
  object_select.c, object_transform.c.
* Rename files to have consistent object_ and mball_ prefix:
  object_shapekey.c, object_lattice.c, object_vgroup.c, mball_edit.c.
* Added operators:
  * vertex group menu and set active
  * apply location, rotation, scale, visual transform (location is new)
  * make local
  * make vertex parent
  * move to layer
  * convert to curve/mesh (not finished yet)
* Many small fixes for marked issues, but still much code to be cleaned
  up here...
											 
										 
										
											2009-09-09 11:52:56 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Scene  * sce  =  ( Scene  * )  BLI_findlink ( & bmain - > scene ,  G . curscreen - > scenenr  -  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									Base  * base ,  * nbase ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( sce  = =  0 )  return ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( sce - > id . lib )  return ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( base  =  FIRSTBASE ;  base ;  base  =  base - > next )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( TESTBASE ( v3d ,  base ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											nbase  =  MEM_mallocN ( sizeof ( Base ) ,  " newbase " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											* nbase  =  * base ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											BLI_addhead ( & ( sce - > base ) ,  nbase ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											id_us_plus ( ( ID  * ) base - > object ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2011-02-17 22:34:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# endif 
  
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-29 18:12:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Base  * ED_object_scene_link ( Scene  * scene ,  Object  * ob )  
						 
					
						
							
								
									
										
										
										
											2012-05-29 08:20:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Base  * base ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( BKE_scene_base_find ( scene ,  ob ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									base  =  BKE_scene_base_add ( scene ,  ob ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									id_us_plus ( & ob - > id ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  base ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-11-04 10:25:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  int  make_links_scene_exec ( bContext  * C ,  wmOperator  * op )  
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Main  * bmain  =  CTX_data_main ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Scene  * scene_to  =  BLI_findlink ( & CTX_data_main ( C ) - > scene ,  RNA_enum_get ( op - > ptr ,  " scene " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-29 18:12:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( scene_to  = =  NULL )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										BKE_report ( op - > reports ,  RPT_ERROR ,  " Couldn't find scene " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( scene_to  = =  CTX_data_scene ( C ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-04 10:25:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BKE_report ( op - > reports ,  RPT_ERROR ,  " Can't link objects into the same scene " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-09 02:45:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-29 18:12:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( scene_to - > id . lib )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										BKE_report ( op - > reports ,  RPT_ERROR ,  " Can't link objects into a linked scene " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-30 16:22:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									CTX_DATA_BEGIN  ( C ,  Base  * ,  base ,  selected_bases ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-29 18:12:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ED_object_scene_link ( scene_to ,  base - > object ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-09 02:45:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-04 10:25:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									CTX_DATA_END ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-08-01 12:47:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									DAG_ids_flush_update ( bmain ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-04 10:25:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* one day multiple scenes will be visible, then we should have some update function for them */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								enum  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									MAKE_LINKS_OBDATA  =  1 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									MAKE_LINKS_MATERIALS , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									MAKE_LINKS_ANIMDATA , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									MAKE_LINKS_DUPLIGROUP , 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-04 16:26:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									MAKE_LINKS_MODIFIERS 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-04 10:25:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								} ;  
						 
					
						
							
								
									
										
										
											
												2.5: Object module
* Split object_edit.c into multiple files:
  object_add.c, object_edit.c, object_hook.c, object_relations.c,
  object_select.c, object_transform.c.
* Rename files to have consistent object_ and mball_ prefix:
  object_shapekey.c, object_lattice.c, object_vgroup.c, mball_edit.c.
* Added operators:
  * vertex group menu and set active
  * apply location, rotation, scale, visual transform (location is new)
  * make local
  * make vertex parent
  * move to layer
  * convert to curve/mesh (not finished yet)
* Many small fixes for marked issues, but still much code to be cleaned
  up here...
											 
										 
										
											2009-09-09 11:52:56 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-06-08 20:24:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* Return 1 if make link data is allow, zero otherwise */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  int  allow_make_links_data ( int  ev ,  Object  * ob ,  Object  * obt )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-04-28 06:31:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									switch  ( ev )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-06-27 23:18:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  MAKE_LINKS_OBDATA : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( ob - > type  = =  obt - > type  & &  ob - > type  ! =  OB_EMPTY ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  MAKE_LINKS_MATERIALS : 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-03 17:29:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( OB_TYPE_SUPPORT_MATERIAL ( ob - > type )  & & 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											    OB_TYPE_SUPPORT_MATERIAL ( obt - > type ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-03 17:29:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											{ 
							 
						 
					
						
							
								
									
										
										
										
											2010-06-27 23:18:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												return  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-03 17:29:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2010-06-27 23:18:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  MAKE_LINKS_ANIMDATA : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  MAKE_LINKS_DUPLIGROUP : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  MAKE_LINKS_MODIFIERS : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( ob - > type  ! =  OB_EMPTY  & &  obt - > type  ! =  OB_EMPTY ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-06-08 20:24:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2010-06-27 23:18:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-06-08 20:24:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-11-04 10:25:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  int  make_links_data_exec ( bContext  * C ,  wmOperator  * op )  
						 
					
						
							
								
									
										
										
											
												2.5: Object module
* Split object_edit.c into multiple files:
  object_add.c, object_edit.c, object_hook.c, object_relations.c,
  object_select.c, object_transform.c.
* Rename files to have consistent object_ and mball_ prefix:
  object_shapekey.c, object_lattice.c, object_vgroup.c, mball_edit.c.
* Added operators:
  * vertex group menu and set active
  * apply location, rotation, scale, visual transform (location is new)
  * make local
  * make vertex parent
  * move to layer
  * convert to curve/mesh (not finished yet)
* Many small fixes for marked issues, but still much code to be cleaned
  up here...
											 
										 
										
											2009-09-09 11:52:56 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Main  * bmain  =  CTX_data_main ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-22 13:30:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  event  =  RNA_enum_get ( op - > ptr ,  " type " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-04 10:25:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Object  * ob ; 
							 
						 
					
						
							
								
									
										
										
											
												2.5: Object module
* Split object_edit.c into multiple files:
  object_add.c, object_edit.c, object_hook.c, object_relations.c,
  object_select.c, object_transform.c.
* Rename files to have consistent object_ and mball_ prefix:
  object_shapekey.c, object_lattice.c, object_vgroup.c, mball_edit.c.
* Added operators:
  * vertex group menu and set active
  * apply location, rotation, scale, visual transform (location is new)
  * make local
  * make vertex parent
  * move to layer
  * convert to curve/mesh (not finished yet)
* Many small fixes for marked issues, but still much code to be cleaned
  up here...
											 
										 
										
											2009-09-09 11:52:56 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									ID  * id ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  a ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ob  =  ED_object_active_context ( C ) ; 
							 
						 
					
						
							
								
									
										
										
											
												2.5: Object module
* Split object_edit.c into multiple files:
  object_add.c, object_edit.c, object_hook.c, object_relations.c,
  object_select.c, object_transform.c.
* Rename files to have consistent object_ and mball_ prefix:
  object_shapekey.c, object_lattice.c, object_vgroup.c, mball_edit.c.
* Added operators:
  * vertex group menu and set active
  * apply location, rotation, scale, visual transform (location is new)
  * make local
  * make vertex parent
  * move to layer
  * convert to curve/mesh (not finished yet)
* Many small fixes for marked issues, but still much code to be cleaned
  up here...
											 
										 
										
											2009-09-09 11:52:56 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-30 16:22:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									CTX_DATA_BEGIN  ( C ,  Object  * ,  obt ,  selected_editable_objects ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ob  ! =  obt )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-06-08 20:24:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( allow_make_links_data ( event ,  ob ,  obt ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 06:31:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												switch  ( event )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													case  MAKE_LINKS_OBDATA :  /* obdata */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														id  =  obt - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														id - > us - - ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														id  =  ob - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														id_us_plus ( id ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														obt - > data  =  id ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														/* if amount of material indices changed: */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														test_object_materials ( obt - > data ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														obt - > recalc  | =  OB_RECALC_DATA ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													case  MAKE_LINKS_MATERIALS : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														/* new approach, using functions from kernel */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														for  ( a  =  0 ;  a  <  ob - > totcol ;  a + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															Material  * ma  =  give_current_material ( ob ,  a  +  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															assign_material ( obt ,  ma ,  a  +  1 ) ;  /* also works with ma==NULL */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													case  MAKE_LINKS_ANIMDATA : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														BKE_copy_animdata_id ( ( ID  * ) obt ,  ( ID  * ) ob ,  FALSE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														BKE_copy_animdata_id ( ( ID  * ) obt - > data ,  ( ID  * ) ob - > data ,  FALSE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													case  MAKE_LINKS_DUPLIGROUP : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														obt - > dup_group  =  ob - > dup_group ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( obt - > dup_group )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															id_lib_extern ( & obt - > dup_group - > id ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															obt - > transflag  | =  OB_DUPLIGROUP ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													case  MAKE_LINKS_MODIFIERS : 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														BKE_object_link_modifiers ( obt ,  ob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														obt - > recalc  | =  OB_RECALC_OB  |  OB_RECALC_DATA  |  OB_RECALC_TIME ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-09 02:45:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
											
												2.5: Object module
* Split object_edit.c into multiple files:
  object_add.c, object_edit.c, object_hook.c, object_relations.c,
  object_select.c, object_transform.c.
* Rename files to have consistent object_ and mball_ prefix:
  object_shapekey.c, object_lattice.c, object_vgroup.c, mball_edit.c.
* Added operators:
  * vertex group menu and set active
  * apply location, rotation, scale, visual transform (location is new)
  * make local
  * make vertex parent
  * move to layer
  * convert to curve/mesh (not finished yet)
* Many small fixes for marked issues, but still much code to be cleaned
  up here...
											 
										 
										
											2009-09-09 11:52:56 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-04 10:25:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									CTX_DATA_END ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-01-29 18:37:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									DAG_scene_sort ( bmain ,  CTX_data_scene ( C ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2010-08-01 12:47:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									DAG_ids_flush_update ( bmain ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									WM_event_add_notifier ( C ,  NC_SPACE  |  ND_SPACE_VIEW3D ,  CTX_wm_view3d ( C ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-04 10:25:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-11-04 10:25:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  OBJECT_OT_make_links_scene ( wmOperatorType  * ot )  
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-11-04 10:25:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									PropertyRNA  * prop ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > name  =  " Link Objects to Scene " ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-09 17:09:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > description  =  " Link selection to another scene " ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > idname  =  " OBJECT_OT_make_links_scene " ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-04 10:25:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > invoke  =  WM_enum_search_invoke ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ot - > exec  =  make_links_scene_exec ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-04 10:25:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* better not run the poll check */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* flags */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > flag  =  OPTYPE_REGISTER  |  OPTYPE_UNDO ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-04 10:25:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* properties */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									prop  =  RNA_def_enum ( ot - > srna ,  " scene " ,  DummyRNA_NULL_items ,  0 ,  " Scene " ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-05-05 15:41:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									RNA_def_enum_funcs ( prop ,  RNA_scene_local_itemf ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > prop  =  prop ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-04 10:25:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  OBJECT_OT_make_links_data ( wmOperatorType  * ot )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									static  EnumPropertyItem  make_links_items [ ]  =  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ MAKE_LINKS_OBDATA ,      " OBDATA " ,  0 ,  " Object Data " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ MAKE_LINKS_MATERIALS ,   " MATERIAL " ,  0 ,  " Materials " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ MAKE_LINKS_ANIMDATA ,    " ANIMATION " ,  0 ,  " Animation Data " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ MAKE_LINKS_DUPLIGROUP ,  " DUPLIGROUP " ,  0 ,  " DupliGroup " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ MAKE_LINKS_MODIFIERS ,   " MODIFIERS " ,  0 ,  " Modifiers " ,  " " } , 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-04 10:25:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										{ 0 ,  NULL ,  0 ,  NULL ,  NULL } } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > name  =  " Link Data " ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-10 21:15:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > description  =  " Make links from the active object to other selected objects " ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > idname  =  " OBJECT_OT_make_links_data " ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-04 10:25:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > exec  =  make_links_data_exec ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ot - > poll  =  ED_operator_object_active ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-04 10:25:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* flags */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > flag  =  OPTYPE_REGISTER  |  OPTYPE_UNDO ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-04 10:25:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* properties */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > prop  =  RNA_def_enum ( ot - > srna ,  " type " ,  make_links_items ,  0 ,  " Type " ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-11-04 10:25:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								/**************************** Make Single User ********************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-02-14 17:55:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  single_object_users ( Scene  * scene ,  View3D  * v3d ,  int  flag ) 	 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Base  * base ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Object  * ob ,  * obn ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									clear_sca_new_poins ( ) ;   /* sensor/contr/act */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* duplicate (must set newid) */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( base  =  FIRSTBASE ;  base ;  base  =  base - > next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ob  =  base - > object ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2011-02-10 10:14:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* newid may still have some trash from Outliner tree building,
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										 *  so  clear  that  first  to  avoid  errors  [ # 26002 ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ob - > id . newid  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  (  ( base - > flag  &  flag )  = =  flag )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( ob - > id . lib  = =  NULL  & &  ob - > id . us  >  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												/* base gets copy of object */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												obn  =  BKE_object_copy ( ob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												base - > object  =  obn ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												ob - > id . us - - ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ID_NEW ( scene - > camera ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( v3d )  ID_NEW ( v3d - > camera ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* object pointers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( base  =  FIRSTBASE ;  base ;  base  =  base - > next )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BKE_object_relink ( base - > object ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									set_sca_new_poins ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-08-08 08:22:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* not an especially efficient function, only added so the single user
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  button  can  be  functional . */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  ED_object_single_user ( Scene  * scene ,  Object  * ob )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Base  * base ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( base  =  FIRSTBASE ;  base ;  base  =  base - > next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( base - > object  = =  ob )  base - > flag  | =   OB_DONE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										else  base - > flag  & =  ~ OB_DONE ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-08 08:22:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									single_object_users ( scene ,  NULL ,  OB_DONE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-02-14 17:55:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  new_id_matar ( Material  * * matar ,  int  totcol )  
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ID  * id ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  a ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( a  =  0 ;  a  <  totcol ;  a + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										id  =  ( ID  * ) matar [ a ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( id  & &  id - > lib  = =  NULL )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( id - > newid )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												matar [ a ]  =  ( Material  * ) id - > newid ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												id_us_plus ( id - > newid ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												id - > us - - ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											else  if  ( id - > us  >  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												matar [ a ]  =  BKE_material_copy ( matar [ a ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												id - > us - - ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												id - > newid  =  ( ID  * ) matar [ a ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-02-14 17:55:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  single_obdata_users ( Main  * bmain ,  Scene  * scene ,  int  flag )  
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Object  * ob ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Lamp  * la ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Curve  * cu ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									//Camera *cam;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Base  * base ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Mesh  * me ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ID  * id ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  a ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( base  =  FIRSTBASE ;  base ;  base  =  base - > next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ob  =  base - > object ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( ob - > id . lib  = =  NULL  & &  ( base - > flag  &  flag )  = =  flag )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											id  =  ob - > data ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( id  & &  id - > us  >  1  & &  id - > lib  = =  NULL )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												ob - > recalc  =  OB_RECALC_DATA ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
									
										
										
										
											2010-12-19 13:50:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												BKE_copy_animdata_id_action ( id ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 06:31:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												switch  ( ob - > type )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													case  OB_LAMP : 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														ob - > data  =  la  =  BKE_lamp_copy ( ob - > data ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														for  ( a  =  0 ;  a  <  MAX_MTEX ;  a + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															if  ( la - > mtex [ a ] )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																ID_NEW ( la - > mtex [ a ] - > object ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													case  OB_CAMERA : 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 00:58:22 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														ob - > data  =  BKE_camera_copy ( ob - > data ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													case  OB_MESH : 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														ob - > data  =  BKE_mesh_copy ( ob - > data ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														//me= ob->data;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														//if (me && me->key)
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														//	ipo_idnew(me->key->ipo);	/* drivers */
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													case  OB_MBALL : 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-07 06:38:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														ob - > data  =  BKE_mball_copy ( ob - > data ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													case  OB_CURVE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													case  OB_SURF : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													case  OB_FONT : 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 16:49:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														ob - > data  =  cu  =  BKE_curve_copy ( ob - > data ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														ID_NEW ( cu - > bevobj ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														ID_NEW ( cu - > taperobj ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													case  OB_LATTICE : 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														ob - > data  =  BKE_lattice_copy ( ob - > data ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													case  OB_ARMATURE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														ob - > recalc  | =  OB_RECALC_DATA ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														ob - > data  =  BKE_armature_copy ( ob - > data ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 16:03:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														BKE_pose_rebuild ( ob ,  ob - > data ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													case  OB_SPEAKER : 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														ob - > data  =  BKE_speaker_copy ( ob - > data ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													default : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( G . debug  &  G_DEBUG ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															printf ( " ERROR %s: can't copy %s \n " ,  __func__ ,  id - > name ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														return ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												id - > us - - ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												id - > newid  =  ob - > data ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									me  =  bmain - > mesh . first ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									while  ( me )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										ID_NEW ( me - > texcomesh ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										me  =  me - > id . next ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-12-19 13:50:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  single_object_action_users ( Scene  * scene ,  int  flag )  
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Object  * ob ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Base  * base ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( base  =  FIRSTBASE ;  base ;  base  =  base - > next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ob  =  base - > object ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( ob - > id . lib  = =  NULL  & &  ( flag  = =  0  | |  ( base - > flag  &  SELECT ) )  )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											ob - > recalc  =  OB_RECALC_DATA ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-19 13:50:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											BKE_copy_animdata_id_action ( & ob - > id ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-11-01 00:06:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  single_mat_users ( Scene  * scene ,  int  flag ,  int  do_textures )  
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Object  * ob ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Base  * base ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Material  * ma ,  * man ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Tex  * tex ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  a ,  b ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( base  =  FIRSTBASE ;  base ;  base  =  base - > next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ob  =  base - > object ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( ob - > id . lib  = =  NULL  & &  ( flag  = =  0  | |  ( base - > flag  &  SELECT ) )  )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											for  ( a  =  1 ;  a  < =  ob - > totcol ;  a + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												ma  =  give_current_material ( ob ,  a ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( ma )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													/* do not test for LIB_NEW: this functions guaranteed delivers single_users! */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( ma - > id . us  >  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														man  =  BKE_material_copy ( ma ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-19 13:50:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														BKE_copy_animdata_id_action ( & man - > id ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														man - > id . us  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
														assign_material ( ob ,  man ,  a ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-19 13:50:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( do_textures )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
															for  ( b  =  0 ;  b  <  MAX_MTEX ;  b + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																if  ( ma - > mtex [ b ]  & &  ( tex  =  ma - > mtex [ b ] - > tex ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																	if  ( tex - > id . us  >  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-01 00:06:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																		tex - > id . us - - ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																		tex  =  BKE_texture_copy ( tex ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-22 17:10:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																		BKE_copy_animdata_id_action ( & tex - > id ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																		man - > mtex [ b ] - > tex  =  tex ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-01 00:06:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
																	} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
																} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-02-14 17:55:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  do_single_tex_user ( Tex  * * from )  
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Tex  * tex ,  * texn ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									tex  =  * from ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( tex  = =  NULL )  return ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( tex - > id . newid )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										* from  =  ( Tex  * ) tex - > id . newid ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										id_us_plus ( tex - > id . newid ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										tex - > id . us - - ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else  if  ( tex - > id . us  >  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 14:03:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										texn  =  BKE_texture_copy ( tex ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-19 13:50:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BKE_copy_animdata_id_action ( & texn - > id ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										tex - > id . newid  =  ( ID  * ) texn ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										tex - > id . us - - ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										* from  =  texn ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-02-14 17:55:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  single_tex_users_expand ( Main  * bmain )  
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* only when 'parent' blocks are LIB_NEW */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Material  * ma ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Lamp  * la ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									World  * wo ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  b ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( ma  =  bmain - > mat . first ;  ma ;  ma  =  ma - > id . next )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ma - > id . flag  &  LIB_NEW )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											for  ( b  =  0 ;  b  <  MAX_MTEX ;  b + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( ma - > mtex [ b ]  & &  ma - > mtex [ b ] - > tex )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-29 17:55:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													do_single_tex_user ( & ( ma - > mtex [ b ] - > tex ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( la  =  bmain - > lamp . first ;  la ;  la  =  la - > id . next )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( la - > id . flag  &  LIB_NEW )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											for  ( b  =  0 ;  b  <  MAX_MTEX ;  b + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( la - > mtex [ b ]  & &  la - > mtex [ b ] - > tex )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-29 17:55:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													do_single_tex_user ( & ( la - > mtex [ b ] - > tex ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( wo  =  bmain - > world . first ;  wo ;  wo  =  wo - > id . next )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( wo - > id . flag  &  LIB_NEW )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											for  ( b  =  0 ;  b  <  MAX_MTEX ;  b + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( wo - > mtex [ b ]  & &  wo - > mtex [ b ] - > tex )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-29 17:55:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													do_single_tex_user ( & ( wo - > mtex [ b ] - > tex ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-08-01 12:47:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  single_mat_users_expand ( Main  * bmain )  
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* only when 'parent' blocks are LIB_NEW */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Object  * ob ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Mesh  * me ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Curve  * cu ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									MetaBall  * mb ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Material  * ma ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  a ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( ob  =  bmain - > object . first ;  ob ;  ob  =  ob - > id . next ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ob - > id . flag  &  LIB_NEW ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											new_id_matar ( ob - > mat ,  ob - > totcol ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( me  =  bmain - > mesh . first ;  me ;  me  =  me - > id . next ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( me - > id . flag  &  LIB_NEW ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											new_id_matar ( me - > mat ,  me - > totcol ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( cu  =  bmain - > curve . first ;  cu ;  cu  =  cu - > id . next ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( cu - > id . flag  &  LIB_NEW ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											new_id_matar ( cu - > mat ,  cu - > totcol ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( mb  =  bmain - > mball . first ;  mb ;  mb  =  mb - > id . next ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( mb - > id . flag  &  LIB_NEW ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											new_id_matar ( mb - > mat ,  mb - > totcol ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* material imats  */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( ma  =  bmain - > mat . first ;  ma ;  ma  =  ma - > id . next ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ma - > id . flag  &  LIB_NEW ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											for  ( a  =  0 ;  a  <  MAX_MTEX ;  a + + ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( ma - > mtex [ a ] ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
													ID_NEW ( ma - > mtex [ a ] - > object ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* used for copying scenes */  
						 
					
						
							
								
									
										
										
										
											2010-08-01 12:47:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  ED_object_single_users ( Main  * bmain ,  Scene  * scene ,  int  full )  
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2010-03-22 09:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									single_object_users ( scene ,  NULL ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( full )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-01 12:47:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										single_obdata_users ( bmain ,  scene ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-06 12:33:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										single_object_action_users ( scene ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-01 12:47:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										single_mat_users_expand ( bmain ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										single_tex_users_expand ( bmain ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-22 09:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									clear_id_newpoins ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/******************************* Make Local ***********************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* helper for below, ma was checked to be not NULL */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  void  make_local_makelocalmaterial ( Material  * ma )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									AnimData  * adt ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  b ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									id_make_local ( & ma - > id ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( b  =  0 ;  b  <  MAX_MTEX ;  b + + ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ma - > mtex [ b ]  & &  ma - > mtex [ b ] - > tex ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											id_make_local ( & ma - > mtex [ b ] - > tex - > id ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									adt  =  BKE_animdata_from_id ( & ma - > id ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( adt )  BKE_animdata_make_local ( adt ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* nodetree? XXX */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  int  make_local_exec ( bContext  * C ,  wmOperator  * op )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Main  * bmain  =  CTX_data_main ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									AnimData  * adt ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ParticleSystem  * psys ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Material  * ma ,  * * * matarar ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Lamp  * la ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ID  * id ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  a ,  b ,  mode  =  RNA_enum_get ( op - > ptr ,  " type " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( mode  = =  3 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										BKE_library_make_local ( bmain ,  NULL ,  0 ) ;  /* NULL is all libs */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										WM_event_add_notifier ( C ,  NC_WINDOW ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									clear_id_newpoins ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-04-30 16:22:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									CTX_DATA_BEGIN  ( C ,  Object  * ,  ob ,  selected_objects ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ob - > id . lib ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											id_make_local ( & ob - > id ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CTX_DATA_END ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* maybe object pointers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-30 16:22:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									CTX_DATA_BEGIN  ( C ,  Object  * ,  ob ,  selected_objects ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ob - > id . lib  = =  NULL )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											ID_NEW ( ob - > parent ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CTX_DATA_END ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-30 16:22:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									CTX_DATA_BEGIN  ( C ,  Object  * ,  ob ,  selected_objects ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										id  =  ob - > data ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( id  & &  mode  >  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											id_make_local ( id ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											adt  =  BKE_animdata_from_id ( id ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( adt )  BKE_animdata_make_local ( adt ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-20 18:54:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* tag indirect data direct */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											matarar  =  ( Material  * * * ) give_matarar ( ob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( matarar )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												for  ( a  =  0 ;  a  <  ob - > totcol ;  a + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													ma  =  ( * matarar ) [ a ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( ma ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-20 18:54:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														id_lib_extern ( & ma - > id ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										for  ( psys  =  ob - > particlesystem . first ;  psys ;  psys  =  psys - > next ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
											id_make_local ( & psys - > part - > id ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										adt  =  BKE_animdata_from_id ( & ob - > id ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( adt )  BKE_animdata_make_local ( adt ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CTX_DATA_END ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( mode  >  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-30 16:22:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										CTX_DATA_BEGIN  ( C ,  Object  * ,  ob ,  selected_objects ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( ob - > type  = =  OB_LAMP )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												la  =  ob - > data ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												for  ( b  =  0 ;  b  <  MAX_MTEX ;  b + + ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( la - > mtex [ b ]  & &  la - > mtex [ b ] - > tex ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
														id_make_local ( & la - > mtex [ b ] - > tex - > id ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											else  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												for  ( a  =  0 ;  a  <  ob - > totcol ;  a + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													ma  =  ob - > mat [ a ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( ma ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
														make_local_makelocalmaterial ( ma ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												matarar  =  ( Material  * * * ) give_matarar ( ob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( matarar )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													for  ( a  =  0 ;  a  <  ob - > totcol ;  a + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														ma  =  ( * matarar ) [ a ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														if  ( ma ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
															make_local_makelocalmaterial ( ma ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										CTX_DATA_END ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									WM_event_add_notifier ( C ,  NC_WINDOW ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  OBJECT_OT_make_local ( wmOperatorType  * ot )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									static  EnumPropertyItem  type_items [ ]  =  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										{ 1 ,  " SELECTED_OBJECTS " ,  0 ,  " Selected Objects " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 2 ,  " SELECTED_OBJECTS_DATA " ,  0 ,  " Selected Objects and Data " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 3 ,  " ALL " ,  0 ,  " All " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 0 ,  NULL ,  0 ,  NULL ,  NULL } } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > name  =  " Make Local " ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-10 21:15:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > description  =  " Make library linked datablocks local to this file " ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > idname  =  " OBJECT_OT_make_local " ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > invoke  =  WM_menu_invoke ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ot - > exec  =  make_local_exec ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ot - > poll  =  ED_operator_objectmode ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* flags */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > flag  =  OPTYPE_REGISTER  |  OPTYPE_UNDO ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* properties */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > prop  =  RNA_def_enum ( ot - > srna ,  " type " ,  type_items ,  0 ,  " Type " ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 17:43:09 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-11-01 00:06:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  int  make_single_user_exec ( bContext  * C ,  wmOperator  * op )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Main  * bmain  =  CTX_data_main ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Scene  * scene  =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									View3D  * v3d  =  CTX_wm_view3d ( C ) ;  /* ok if this is NULL */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  flag  =  RNA_enum_get ( op - > ptr ,  " type " ) ;  /* 0==ALL, SELECTED==selected objecs */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-01 00:06:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( RNA_boolean_get ( op - > ptr ,  " object " ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-22 09:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										single_object_users ( scene ,  v3d ,  flag ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-01 00:06:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( RNA_boolean_get ( op - > ptr ,  " obdata " ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-01 12:47:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										single_obdata_users ( bmain ,  scene ,  flag ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-01 00:06:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( RNA_boolean_get ( op - > ptr ,  " material " ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-22 17:10:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										single_mat_users ( scene ,  flag ,  RNA_boolean_get ( op - > ptr ,  " texture " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-01 00:06:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-05-22 17:10:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								#if 0  /* can't do this separate from materials */
  
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( RNA_boolean_get ( op - > ptr ,  " texture " ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-01 00:06:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										single_mat_users ( scene ,  flag ,  TRUE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-22 17:10:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# endif 
  
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( RNA_boolean_get ( op - > ptr ,  " animation " ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-19 13:50:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										single_object_action_users ( scene ,  flag ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-01 00:06:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									clear_id_newpoins ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									WM_event_add_notifier ( C ,  NC_WINDOW ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  OBJECT_OT_make_single_user ( wmOperatorType  * ot )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									static  EnumPropertyItem  type_items [ ]  =  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-01 00:06:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										{ SELECT ,  " SELECTED_OBJECTS " ,  0 ,  " Selected Objects " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 0 ,  " ALL " ,  0 ,  " All " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 0 ,  NULL ,  0 ,  NULL ,  NULL } } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > name  =  " Make Single User " ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-10 21:15:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > description  =  " Make linked data local to each object " ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > idname  =  " OBJECT_OT_make_single_user " ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-01 00:06:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > invoke  =  WM_menu_invoke ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ot - > exec  =  make_single_user_exec ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ot - > poll  =  ED_operator_objectmode ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-01 00:06:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* flags */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > flag  =  OPTYPE_REGISTER  |  OPTYPE_UNDO ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-01 00:06:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* properties */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > prop  =  RNA_def_enum ( ot - > srna ,  " type " ,  type_items ,  SELECT ,  " Type " ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-01 00:06:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									RNA_def_boolean ( ot - > srna ,  " object " ,  0 ,  " Object " ,  " Make single user objects " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									RNA_def_boolean ( ot - > srna ,  " obdata " ,  0 ,  " Object Data " ,  " Make single user object data " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									RNA_def_boolean ( ot - > srna ,  " material " ,  0 ,  " Materials " ,  " Make materials local to each datablock " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									RNA_def_boolean ( ot - > srna ,  " texture " ,  0 ,  " Textures " ,  " Make textures local to each material " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-19 13:50:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									RNA_def_boolean ( ot - > srna ,  " animation " ,  0 ,  " Object Animation " ,  " Make animation data local to each object " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-01 00:06:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
											 
										
											
												Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
  There are calls to define drag-able images, ID blocks, RNA paths, 
  file paths, and so on. By default you drag an icon, exceptionally 
  an ImBuf
- Drag items are registered centrally in the WM, it allows more drag 
  items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts 
  the mouse event to an EVT_DROP type. This event then gets the full 
  drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps 
  you can make a "drop map" this way, which become 'drop map handlers' 
  in the queues.
- next to that the UI kit handles some common button types (like 
  accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
  - poll() = check if the event drag data is relevant for this box
  - copy() = fill in custom properties in the dropbox to initialize 
    an operator
- The dropbox handler then calls its standard Operator with its 
  dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit 
on mouse-over. In case the icon is a button or UI element too (most 
cases), the drag-able feature will make the item react to 
mouse-release instead of mouse-press. 
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works 
too. I've added code that passes on mousemoves and clicks to other 
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an 
Image ID... keep this in mind. Sequencer for example wants paths to 
be dropped,  textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're 
part of the UI and editor design (= how we want an editor to work), and 
not default offered configurable like keymaps. 
- At the moment only one item can be dragged at a time. This is for 
several reasons.... For one, Blender doesn't have a well defined 
uniform way to define "what is selected" (files, outliner items, etc). 
Secondly there's potential conflicts on what todo when you drop mixed 
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip, 
should be represented in filewindow as a single sequence anyway. 
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it 
could show the operator as a sort of menu, allowing arrow or scrollwheel 
to choose. For time being I'd prefer to try to design a singular drop 
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that 
detects an object (type) under cursor, so a drag item's option can be 
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled, 
while WM event code tried same. Added new OPERATOR_HANDLED flag for this. 
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
  (for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review... 
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS 
into Blender window. I've noticed this code is unfinished for Macs, but 
seems to be complete for Windows. Needs test... currently, an external 
drop event will print in console when succesfully delivered to Blender's WM.
											 
										 
										
											2010-01-26 18:18:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  int  drop_named_material_invoke ( bContext  * C ,  wmOperator  * op ,  wmEvent  * event )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Main  * bmain  =  CTX_data_main ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Base  * base  =  ED_view3d_give_base_under_cursor ( C ,  event - > mval ) ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
  There are calls to define drag-able images, ID blocks, RNA paths, 
  file paths, and so on. By default you drag an icon, exceptionally 
  an ImBuf
- Drag items are registered centrally in the WM, it allows more drag 
  items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts 
  the mouse event to an EVT_DROP type. This event then gets the full 
  drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps 
  you can make a "drop map" this way, which become 'drop map handlers' 
  in the queues.
- next to that the UI kit handles some common button types (like 
  accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
  - poll() = check if the event drag data is relevant for this box
  - copy() = fill in custom properties in the dropbox to initialize 
    an operator
- The dropbox handler then calls its standard Operator with its 
  dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit 
on mouse-over. In case the icon is a button or UI element too (most 
cases), the drag-able feature will make the item react to 
mouse-release instead of mouse-press. 
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works 
too. I've added code that passes on mousemoves and clicks to other 
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an 
Image ID... keep this in mind. Sequencer for example wants paths to 
be dropped,  textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're 
part of the UI and editor design (= how we want an editor to work), and 
not default offered configurable like keymaps. 
- At the moment only one item can be dragged at a time. This is for 
several reasons.... For one, Blender doesn't have a well defined 
uniform way to define "what is selected" (files, outliner items, etc). 
Secondly there's potential conflicts on what todo when you drop mixed 
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip, 
should be represented in filewindow as a single sequence anyway. 
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it 
could show the operator as a sort of menu, allowing arrow or scrollwheel 
to choose. For time being I'd prefer to try to design a singular drop 
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that 
detects an object (type) under cursor, so a drag item's option can be 
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled, 
while WM event code tried same. Added new OPERATOR_HANDLED flag for this. 
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
  (for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review... 
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS 
into Blender window. I've noticed this code is unfinished for Macs, but 
seems to be complete for Windows. Needs test... currently, an external 
drop event will print in console when succesfully delivered to Blender's WM.
											 
										 
										
											2010-01-26 18:18:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Material  * ma ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									char  name [ MAX_ID_NAME  -  2 ] ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
  There are calls to define drag-able images, ID blocks, RNA paths, 
  file paths, and so on. By default you drag an icon, exceptionally 
  an ImBuf
- Drag items are registered centrally in the WM, it allows more drag 
  items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts 
  the mouse event to an EVT_DROP type. This event then gets the full 
  drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps 
  you can make a "drop map" this way, which become 'drop map handlers' 
  in the queues.
- next to that the UI kit handles some common button types (like 
  accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
  - poll() = check if the event drag data is relevant for this box
  - copy() = fill in custom properties in the dropbox to initialize 
    an operator
- The dropbox handler then calls its standard Operator with its 
  dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit 
on mouse-over. In case the icon is a button or UI element too (most 
cases), the drag-able feature will make the item react to 
mouse-release instead of mouse-press. 
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works 
too. I've added code that passes on mousemoves and clicks to other 
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an 
Image ID... keep this in mind. Sequencer for example wants paths to 
be dropped,  textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're 
part of the UI and editor design (= how we want an editor to work), and 
not default offered configurable like keymaps. 
- At the moment only one item can be dragged at a time. This is for 
several reasons.... For one, Blender doesn't have a well defined 
uniform way to define "what is selected" (files, outliner items, etc). 
Secondly there's potential conflicts on what todo when you drop mixed 
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip, 
should be represented in filewindow as a single sequence anyway. 
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it 
could show the operator as a sort of menu, allowing arrow or scrollwheel 
to choose. For time being I'd prefer to try to design a singular drop 
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that 
detects an object (type) under cursor, so a drag item's option can be 
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled, 
while WM event code tried same. Added new OPERATOR_HANDLED flag for this. 
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
  (for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review... 
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS 
into Blender window. I've noticed this code is unfinished for Macs, but 
seems to be complete for Windows. Needs test... currently, an external 
drop event will print in console when succesfully delivered to Blender's WM.
											 
										 
										
											2010-01-26 18:18:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									RNA_string_get ( op - > ptr ,  " name " ,  name ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 17:00:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ma  =  ( Material  * ) BKE_libblock_find_name ( ID_MA ,  name ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( base  = =  NULL  | |  ma  = =  NULL ) 
							 
						 
					
						
							
								
									
										
											 
										
											
												Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
  There are calls to define drag-able images, ID blocks, RNA paths, 
  file paths, and so on. By default you drag an icon, exceptionally 
  an ImBuf
- Drag items are registered centrally in the WM, it allows more drag 
  items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts 
  the mouse event to an EVT_DROP type. This event then gets the full 
  drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps 
  you can make a "drop map" this way, which become 'drop map handlers' 
  in the queues.
- next to that the UI kit handles some common button types (like 
  accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
  - poll() = check if the event drag data is relevant for this box
  - copy() = fill in custom properties in the dropbox to initialize 
    an operator
- The dropbox handler then calls its standard Operator with its 
  dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit 
on mouse-over. In case the icon is a button or UI element too (most 
cases), the drag-able feature will make the item react to 
mouse-release instead of mouse-press. 
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works 
too. I've added code that passes on mousemoves and clicks to other 
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an 
Image ID... keep this in mind. Sequencer for example wants paths to 
be dropped,  textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're 
part of the UI and editor design (= how we want an editor to work), and 
not default offered configurable like keymaps. 
- At the moment only one item can be dragged at a time. This is for 
several reasons.... For one, Blender doesn't have a well defined 
uniform way to define "what is selected" (files, outliner items, etc). 
Secondly there's potential conflicts on what todo when you drop mixed 
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip, 
should be represented in filewindow as a single sequence anyway. 
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it 
could show the operator as a sort of menu, allowing arrow or scrollwheel 
to choose. For time being I'd prefer to try to design a singular drop 
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that 
detects an object (type) under cursor, so a drag item's option can be 
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled, 
while WM event code tried same. Added new OPERATOR_HANDLED flag for this. 
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
  (for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review... 
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS 
into Blender window. I've noticed this code is unfinished for Macs, but 
seems to be complete for Windows. Needs test... currently, an external 
drop event will print in console when succesfully delivered to Blender's WM.
											 
										 
										
											2010-01-26 18:18:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									assign_material ( base - > object ,  ma ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2010-08-01 12:47:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									DAG_ids_flush_update ( bmain ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									WM_event_add_notifier ( C ,  NC_SPACE  |  ND_SPACE_VIEW3D ,  CTX_wm_view3d ( C ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-09 21:43:22 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									WM_event_add_notifier ( C ,  NC_MATERIAL  |  ND_SHADING ,  ma ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-27 15:08:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
											 
										
											
												Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
  There are calls to define drag-able images, ID blocks, RNA paths, 
  file paths, and so on. By default you drag an icon, exceptionally 
  an ImBuf
- Drag items are registered centrally in the WM, it allows more drag 
  items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts 
  the mouse event to an EVT_DROP type. This event then gets the full 
  drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps 
  you can make a "drop map" this way, which become 'drop map handlers' 
  in the queues.
- next to that the UI kit handles some common button types (like 
  accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
  - poll() = check if the event drag data is relevant for this box
  - copy() = fill in custom properties in the dropbox to initialize 
    an operator
- The dropbox handler then calls its standard Operator with its 
  dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit 
on mouse-over. In case the icon is a button or UI element too (most 
cases), the drag-able feature will make the item react to 
mouse-release instead of mouse-press. 
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works 
too. I've added code that passes on mousemoves and clicks to other 
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an 
Image ID... keep this in mind. Sequencer for example wants paths to 
be dropped,  textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're 
part of the UI and editor design (= how we want an editor to work), and 
not default offered configurable like keymaps. 
- At the moment only one item can be dragged at a time. This is for 
several reasons.... For one, Blender doesn't have a well defined 
uniform way to define "what is selected" (files, outliner items, etc). 
Secondly there's potential conflicts on what todo when you drop mixed 
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip, 
should be represented in filewindow as a single sequence anyway. 
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it 
could show the operator as a sort of menu, allowing arrow or scrollwheel 
to choose. For time being I'd prefer to try to design a singular drop 
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that 
detects an object (type) under cursor, so a drag item's option can be 
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled, 
while WM event code tried same. Added new OPERATOR_HANDLED flag for this. 
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
  (for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review... 
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS 
into Blender window. I've noticed this code is unfinished for Macs, but 
seems to be complete for Windows. Needs test... currently, an external 
drop event will print in console when succesfully delivered to Blender's WM.
											 
										 
										
											2010-01-26 18:18:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* used for dropbox */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* assigns to object under cursor, only first material slot */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  OBJECT_OT_drop_named_material ( wmOperatorType  * ot )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > name  =  " Drop Named Material on Object " ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
  There are calls to define drag-able images, ID blocks, RNA paths, 
  file paths, and so on. By default you drag an icon, exceptionally 
  an ImBuf
- Drag items are registered centrally in the WM, it allows more drag 
  items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts 
  the mouse event to an EVT_DROP type. This event then gets the full 
  drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps 
  you can make a "drop map" this way, which become 'drop map handlers' 
  in the queues.
- next to that the UI kit handles some common button types (like 
  accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
  - poll() = check if the event drag data is relevant for this box
  - copy() = fill in custom properties in the dropbox to initialize 
    an operator
- The dropbox handler then calls its standard Operator with its 
  dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit 
on mouse-over. In case the icon is a button or UI element too (most 
cases), the drag-able feature will make the item react to 
mouse-release instead of mouse-press. 
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works 
too. I've added code that passes on mousemoves and clicks to other 
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an 
Image ID... keep this in mind. Sequencer for example wants paths to 
be dropped,  textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're 
part of the UI and editor design (= how we want an editor to work), and 
not default offered configurable like keymaps. 
- At the moment only one item can be dragged at a time. This is for 
several reasons.... For one, Blender doesn't have a well defined 
uniform way to define "what is selected" (files, outliner items, etc). 
Secondly there's potential conflicts on what todo when you drop mixed 
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip, 
should be represented in filewindow as a single sequence anyway. 
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it 
could show the operator as a sort of menu, allowing arrow or scrollwheel 
to choose. For time being I'd prefer to try to design a singular drop 
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that 
detects an object (type) under cursor, so a drag item's option can be 
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled, 
while WM event code tried same. Added new OPERATOR_HANDLED flag for this. 
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
  (for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review... 
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS 
into Blender window. I've noticed this code is unfinished for Macs, but 
seems to be complete for Windows. Needs test... currently, an external 
drop event will print in console when succesfully delivered to Blender's WM.
											 
										 
										
											2010-01-26 18:18:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > description  =  " " ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > idname  =  " OBJECT_OT_drop_named_material " ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
  There are calls to define drag-able images, ID blocks, RNA paths, 
  file paths, and so on. By default you drag an icon, exceptionally 
  an ImBuf
- Drag items are registered centrally in the WM, it allows more drag 
  items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts 
  the mouse event to an EVT_DROP type. This event then gets the full 
  drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps 
  you can make a "drop map" this way, which become 'drop map handlers' 
  in the queues.
- next to that the UI kit handles some common button types (like 
  accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
  - poll() = check if the event drag data is relevant for this box
  - copy() = fill in custom properties in the dropbox to initialize 
    an operator
- The dropbox handler then calls its standard Operator with its 
  dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit 
on mouse-over. In case the icon is a button or UI element too (most 
cases), the drag-able feature will make the item react to 
mouse-release instead of mouse-press. 
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works 
too. I've added code that passes on mousemoves and clicks to other 
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an 
Image ID... keep this in mind. Sequencer for example wants paths to 
be dropped,  textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're 
part of the UI and editor design (= how we want an editor to work), and 
not default offered configurable like keymaps. 
- At the moment only one item can be dragged at a time. This is for 
several reasons.... For one, Blender doesn't have a well defined 
uniform way to define "what is selected" (files, outliner items, etc). 
Secondly there's potential conflicts on what todo when you drop mixed 
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip, 
should be represented in filewindow as a single sequence anyway. 
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it 
could show the operator as a sort of menu, allowing arrow or scrollwheel 
to choose. For time being I'd prefer to try to design a singular drop 
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that 
detects an object (type) under cursor, so a drag item's option can be 
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled, 
while WM event code tried same. Added new OPERATOR_HANDLED flag for this. 
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
  (for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review... 
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS 
into Blender window. I've noticed this code is unfinished for Macs, but 
seems to be complete for Windows. Needs test... currently, an external 
drop event will print in console when succesfully delivered to Blender's WM.
											 
										 
										
											2010-01-26 18:18:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > invoke  =  drop_named_material_invoke ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ot - > poll  =  ED_operator_objectmode ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
  There are calls to define drag-able images, ID blocks, RNA paths, 
  file paths, and so on. By default you drag an icon, exceptionally 
  an ImBuf
- Drag items are registered centrally in the WM, it allows more drag 
  items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts 
  the mouse event to an EVT_DROP type. This event then gets the full 
  drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps 
  you can make a "drop map" this way, which become 'drop map handlers' 
  in the queues.
- next to that the UI kit handles some common button types (like 
  accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
  - poll() = check if the event drag data is relevant for this box
  - copy() = fill in custom properties in the dropbox to initialize 
    an operator
- The dropbox handler then calls its standard Operator with its 
  dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit 
on mouse-over. In case the icon is a button or UI element too (most 
cases), the drag-able feature will make the item react to 
mouse-release instead of mouse-press. 
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works 
too. I've added code that passes on mousemoves and clicks to other 
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an 
Image ID... keep this in mind. Sequencer for example wants paths to 
be dropped,  textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're 
part of the UI and editor design (= how we want an editor to work), and 
not default offered configurable like keymaps. 
- At the moment only one item can be dragged at a time. This is for 
several reasons.... For one, Blender doesn't have a well defined 
uniform way to define "what is selected" (files, outliner items, etc). 
Secondly there's potential conflicts on what todo when you drop mixed 
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip, 
should be represented in filewindow as a single sequence anyway. 
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it 
could show the operator as a sort of menu, allowing arrow or scrollwheel 
to choose. For time being I'd prefer to try to design a singular drop 
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that 
detects an object (type) under cursor, so a drag item's option can be 
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled, 
while WM event code tried same. Added new OPERATOR_HANDLED flag for this. 
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
  (for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review... 
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS 
into Blender window. I've noticed this code is unfinished for Macs, but 
seems to be complete for Windows. Needs test... currently, an external 
drop event will print in console when succesfully delivered to Blender's WM.
											 
										 
										
											2010-01-26 18:18:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* flags */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ot - > flag  =  OPTYPE_UNDO ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
  There are calls to define drag-able images, ID blocks, RNA paths, 
  file paths, and so on. By default you drag an icon, exceptionally 
  an ImBuf
- Drag items are registered centrally in the WM, it allows more drag 
  items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts 
  the mouse event to an EVT_DROP type. This event then gets the full 
  drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps 
  you can make a "drop map" this way, which become 'drop map handlers' 
  in the queues.
- next to that the UI kit handles some common button types (like 
  accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
  - poll() = check if the event drag data is relevant for this box
  - copy() = fill in custom properties in the dropbox to initialize 
    an operator
- The dropbox handler then calls its standard Operator with its 
  dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit 
on mouse-over. In case the icon is a button or UI element too (most 
cases), the drag-able feature will make the item react to 
mouse-release instead of mouse-press. 
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works 
too. I've added code that passes on mousemoves and clicks to other 
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an 
Image ID... keep this in mind. Sequencer for example wants paths to 
be dropped,  textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're 
part of the UI and editor design (= how we want an editor to work), and 
not default offered configurable like keymaps. 
- At the moment only one item can be dragged at a time. This is for 
several reasons.... For one, Blender doesn't have a well defined 
uniform way to define "what is selected" (files, outliner items, etc). 
Secondly there's potential conflicts on what todo when you drop mixed 
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip, 
should be represented in filewindow as a single sequence anyway. 
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it 
could show the operator as a sort of menu, allowing arrow or scrollwheel 
to choose. For time being I'd prefer to try to design a singular drop 
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that 
detects an object (type) under cursor, so a drag item's option can be 
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled, 
while WM event code tried same. Added new OPERATOR_HANDLED flag for this. 
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
  (for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review... 
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS 
into Blender window. I've noticed this code is unfinished for Macs, but 
seems to be complete for Windows. Needs test... currently, an external 
drop event will print in console when succesfully delivered to Blender's WM.
											 
										 
										
											2010-01-26 18:18:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* properties */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 15:42:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									RNA_def_string ( ot - > srna ,  " name " ,  " Material " ,  MAX_ID_NAME  -  2 ,  " Name " ,  " Material name to assign " ) ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
  There are calls to define drag-able images, ID blocks, RNA paths, 
  file paths, and so on. By default you drag an icon, exceptionally 
  an ImBuf
- Drag items are registered centrally in the WM, it allows more drag 
  items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts 
  the mouse event to an EVT_DROP type. This event then gets the full 
  drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps 
  you can make a "drop map" this way, which become 'drop map handlers' 
  in the queues.
- next to that the UI kit handles some common button types (like 
  accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
  - poll() = check if the event drag data is relevant for this box
  - copy() = fill in custom properties in the dropbox to initialize 
    an operator
- The dropbox handler then calls its standard Operator with its 
  dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit 
on mouse-over. In case the icon is a button or UI element too (most 
cases), the drag-able feature will make the item react to 
mouse-release instead of mouse-press. 
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works 
too. I've added code that passes on mousemoves and clicks to other 
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an 
Image ID... keep this in mind. Sequencer for example wants paths to 
be dropped,  textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're 
part of the UI and editor design (= how we want an editor to work), and 
not default offered configurable like keymaps. 
- At the moment only one item can be dragged at a time. This is for 
several reasons.... For one, Blender doesn't have a well defined 
uniform way to define "what is selected" (files, outliner items, etc). 
Secondly there's potential conflicts on what todo when you drop mixed 
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip, 
should be represented in filewindow as a single sequence anyway. 
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it 
could show the operator as a sort of menu, allowing arrow or scrollwheel 
to choose. For time being I'd prefer to try to design a singular drop 
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that 
detects an object (type) under cursor, so a drag item's option can be 
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled, 
while WM event code tried same. Added new OPERATOR_HANDLED flag for this. 
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
  (for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review... 
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS 
into Blender window. I've noticed this code is unfinished for Macs, but 
seems to be complete for Windows. Needs test... currently, an external 
drop event will print in console when succesfully delivered to Blender's WM.
											 
										 
										
											2010-01-26 18:18:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}