2008-12-23 19:47:33 +00:00
|
|
|
/**
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* 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 *****
|
|
|
|
*/
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <math.h>
|
|
|
|
#include <time.h>
|
2009-09-03 10:42:53 +00:00
|
|
|
#include <float.h>
|
|
|
|
#include <ctype.h>
|
2008-12-23 19:47:33 +00:00
|
|
|
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
|
|
#include "IMB_imbuf_types.h"
|
|
|
|
|
|
|
|
#include "DNA_action_types.h"
|
|
|
|
#include "DNA_armature_types.h"
|
|
|
|
#include "DNA_camera_types.h"
|
|
|
|
#include "DNA_constraint_types.h"
|
|
|
|
#include "DNA_curve_types.h"
|
|
|
|
#include "DNA_effect_types.h"
|
|
|
|
#include "DNA_group_types.h"
|
|
|
|
#include "DNA_image_types.h"
|
|
|
|
#include "DNA_key_types.h"
|
|
|
|
#include "DNA_lamp_types.h"
|
|
|
|
#include "DNA_lattice_types.h"
|
|
|
|
#include "DNA_material_types.h"
|
|
|
|
#include "DNA_mesh_types.h"
|
|
|
|
#include "DNA_meshdata_types.h"
|
|
|
|
#include "DNA_meta_types.h"
|
|
|
|
#include "DNA_nla_types.h"
|
|
|
|
#include "DNA_object_types.h"
|
|
|
|
#include "DNA_object_fluidsim.h"
|
|
|
|
#include "DNA_object_force.h"
|
|
|
|
#include "DNA_scene_types.h"
|
|
|
|
#include "DNA_space_types.h"
|
|
|
|
#include "DNA_screen_types.h"
|
|
|
|
#include "DNA_texture_types.h"
|
|
|
|
#include "DNA_particle_types.h"
|
|
|
|
#include "DNA_property_types.h"
|
|
|
|
#include "DNA_userdef_types.h"
|
|
|
|
#include "DNA_view3d_types.h"
|
|
|
|
#include "DNA_vfont_types.h"
|
|
|
|
#include "DNA_world_types.h"
|
|
|
|
#include "DNA_modifier_types.h"
|
|
|
|
|
|
|
|
#include "BLI_blenlib.h"
|
|
|
|
#include "BLI_arithb.h"
|
|
|
|
#include "BLI_editVert.h"
|
|
|
|
#include "BLI_ghash.h"
|
|
|
|
#include "BLI_rand.h"
|
|
|
|
|
|
|
|
#include "BKE_action.h"
|
|
|
|
#include "BKE_anim.h"
|
|
|
|
#include "BKE_armature.h"
|
|
|
|
#include "BKE_booleanops.h"
|
|
|
|
#include "BKE_constraint.h"
|
|
|
|
#include "BKE_context.h"
|
|
|
|
#include "BKE_customdata.h"
|
|
|
|
#include "BKE_blender.h"
|
|
|
|
#include "BKE_booleanops.h"
|
|
|
|
#include "BKE_cloth.h"
|
|
|
|
#include "BKE_curve.h"
|
|
|
|
#include "BKE_displist.h"
|
|
|
|
#include "BKE_depsgraph.h"
|
|
|
|
#include "BKE_DerivedMesh.h"
|
|
|
|
#include "BKE_effect.h"
|
|
|
|
#include "BKE_font.h"
|
|
|
|
#include "BKE_global.h"
|
|
|
|
#include "BKE_group.h"
|
|
|
|
#include "BKE_image.h"
|
|
|
|
#include "BKE_key.h"
|
|
|
|
#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_nla.h"
|
|
|
|
#include "BKE_object.h"
|
2009-08-15 19:48:50 +00:00
|
|
|
#include "BKE_paint.h"
|
2008-12-23 19:47:33 +00:00
|
|
|
#include "BKE_particle.h"
|
2009-09-04 23:06:15 +00:00
|
|
|
#include "BKE_pointcache.h"
|
2008-12-23 19:47:33 +00:00
|
|
|
#include "BKE_property.h"
|
2009-01-21 02:24:12 +00:00
|
|
|
#include "BKE_report.h"
|
2008-12-23 19:47:33 +00:00
|
|
|
#include "BKE_sca.h"
|
|
|
|
#include "BKE_scene.h"
|
|
|
|
#include "BKE_softbody.h"
|
|
|
|
#include "BKE_subsurf.h"
|
|
|
|
#include "BKE_texture.h"
|
|
|
|
#include "BKE_utildefines.h"
|
|
|
|
#include "BKE_modifier.h"
|
|
|
|
|
|
|
|
#include "ED_anim_api.h"
|
2009-01-05 19:32:04 +00:00
|
|
|
#include "ED_armature.h"
|
2009-01-14 12:26:45 +00:00
|
|
|
#include "ED_curve.h"
|
2009-02-20 20:39:27 +00:00
|
|
|
#include "ED_particle.h"
|
2008-12-31 17:11:42 +00:00
|
|
|
#include "ED_mesh.h"
|
2009-07-29 12:35:09 +00:00
|
|
|
#include "ED_mball.h"
|
2009-01-01 18:05:12 +00:00
|
|
|
#include "ED_object.h"
|
2008-12-23 19:47:33 +00:00
|
|
|
#include "ED_screen.h"
|
2009-07-08 16:17:47 +00:00
|
|
|
#include "ED_transform.h"
|
2008-12-23 19:47:33 +00:00
|
|
|
#include "ED_types.h"
|
|
|
|
#include "ED_util.h"
|
|
|
|
#include "ED_view3d.h"
|
|
|
|
|
|
|
|
#include "UI_interface.h"
|
|
|
|
|
|
|
|
#include "RNA_access.h"
|
|
|
|
#include "RNA_define.h"
|
2009-08-16 05:48:07 +00:00
|
|
|
#include "RNA_enum_types.h"
|
2008-12-23 19:47:33 +00:00
|
|
|
|
2009-01-02 03:16:38 +00:00
|
|
|
/* for menu/popup icons etc etc*/
|
|
|
|
#include "UI_interface.h"
|
|
|
|
#include "UI_resources.h"
|
|
|
|
|
2008-12-23 19:47:33 +00:00
|
|
|
#include "WM_api.h"
|
|
|
|
#include "WM_types.h"
|
|
|
|
|
|
|
|
#include "object_intern.h" // own include
|
|
|
|
|
|
|
|
/* ************* XXX **************** */
|
|
|
|
static void error() {}
|
2009-07-31 01:40:15 +00:00
|
|
|
static void waitcursor(int val) {}
|
|
|
|
static int pupmenu(const char *msg) {return 0;}
|
2008-12-23 19:47:33 +00:00
|
|
|
|
|
|
|
/* port over here */
|
|
|
|
static bContext *C;
|
|
|
|
static void error_libdata() {}
|
|
|
|
|
|
|
|
/* ********************************** */
|
|
|
|
|
|
|
|
/* --------------------------------- */
|
|
|
|
|
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
|
|
|
void ED_object_apply_obmat(Object *ob)
|
2008-12-29 12:15:42 +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
|
|
|
float mat[3][3], imat[3][3], tmat[3][3];
|
2008-12-29 12:15:42 +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
|
|
|
/* from obmat to loc rot size */
|
2008-12-29 12:15:42 +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
|
|
|
if(ob==NULL) return;
|
|
|
|
Mat3CpyMat4(mat, ob->obmat);
|
|
|
|
|
|
|
|
VECCOPY(ob->loc, ob->obmat[3]);
|
2008-12-29 12:15:42 +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
|
|
|
Mat3ToEul(mat, ob->rot);
|
|
|
|
EulToMat3(ob->rot, tmat);
|
2008-12-29 12:15:42 +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
|
|
|
Mat3Inv(imat, tmat);
|
2009-01-05 15:19:31 +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
|
|
|
Mat3MulMat3(tmat, imat, mat);
|
|
|
|
|
|
|
|
ob->size[0]= tmat[0][0];
|
|
|
|
ob->size[1]= tmat[1][1];
|
|
|
|
ob->size[2]= tmat[2][2];
|
2009-01-05 15:19:31 +00:00
|
|
|
|
2009-01-15 16:07:39 +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
|
|
|
/* ********* clear/set restrict view *********/
|
|
|
|
static int object_restrictview_clear_exec(bContext *C, wmOperator *op)
|
2009-01-15 16:07:39 +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
|
|
|
ScrArea *sa= CTX_wm_area(C);
|
|
|
|
View3D *v3d= sa->spacedata.first;
|
2009-01-15 16:07:39 +00:00
|
|
|
Scene *scene= CTX_data_scene(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
|
|
|
Base *base;
|
|
|
|
int changed = 0;
|
2009-01-15 16:07:39 +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
|
|
|
/* XXX need a context loop to handle such cases */
|
|
|
|
for(base = FIRSTBASE; base; base=base->next){
|
|
|
|
if((base->lay & v3d->lay) && base->object->restrictflag & OB_RESTRICT_VIEW) {
|
|
|
|
base->flag |= SELECT;
|
|
|
|
base->object->flag = base->flag;
|
|
|
|
base->object->restrictflag &= ~OB_RESTRICT_VIEW;
|
|
|
|
changed = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (changed) {
|
|
|
|
DAG_scene_sort(scene);
|
|
|
|
WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
|
|
|
|
}
|
2009-01-26 15:23:29 +00:00
|
|
|
|
2009-01-15 16:07:39 +00:00
|
|
|
return OPERATOR_FINISHED;
|
2008-12-23 19:47:33 +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
|
|
|
void OBJECT_OT_restrictview_clear(wmOperatorType *ot)
|
2008-12-23 19:47:33 +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-01-15 16:07:39 +00:00
|
|
|
/* identifiers */
|
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
|
|
|
ot->name= "Clear Restrict View";
|
|
|
|
ot->description = "Reveal the object by setting the restrictview flag.";
|
|
|
|
ot->idname= "OBJECT_OT_restrictview_clear";
|
2009-01-15 16:07:39 +00:00
|
|
|
|
|
|
|
/* api callbacks */
|
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
|
|
|
ot->exec= object_restrictview_clear_exec;
|
|
|
|
ot->poll= ED_operator_view3d_active;
|
2009-01-31 19:40:40 +00:00
|
|
|
|
|
|
|
/* flags */
|
|
|
|
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
2008-12-23 19:47:33 +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
|
|
|
static int object_restrictview_set_exec(bContext *C, wmOperator *op)
|
2009-01-25 20:22:05 +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
|
|
|
Scene *scene= CTX_data_scene(C);
|
|
|
|
short changed = 0;
|
|
|
|
int unselected= RNA_boolean_get(op->ptr, "unselected");
|
2009-01-25 20:22:05 +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
|
|
|
CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
|
|
|
|
if(!unselected) {
|
|
|
|
if (base->flag & SELECT){
|
|
|
|
base->flag &= ~SELECT;
|
|
|
|
base->object->flag = base->flag;
|
|
|
|
base->object->restrictflag |= OB_RESTRICT_VIEW;
|
|
|
|
changed = 1;
|
|
|
|
if (base==BASACT) {
|
|
|
|
ED_base_object_activate(C, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (!(base->flag & SELECT)){
|
|
|
|
base->object->restrictflag |= OB_RESTRICT_VIEW;
|
|
|
|
changed = 1;
|
|
|
|
}
|
|
|
|
}
|
2009-01-25 20:22:05 +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
|
|
|
CTX_DATA_END;
|
|
|
|
|
|
|
|
if (changed) {
|
|
|
|
DAG_scene_sort(scene);
|
|
|
|
|
|
|
|
WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
|
|
|
|
|
2009-01-25 20:22:05 +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-01-25 20:22:05 +00:00
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
void OBJECT_OT_restrictview_set(wmOperatorType *ot)
|
2009-01-25 20:22:05 +00:00
|
|
|
{
|
|
|
|
/* identifiers */
|
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
|
|
|
ot->name= "Set Restrict View";
|
|
|
|
ot->description = "Hide the object by setting the restrictview flag.";
|
|
|
|
ot->idname= "OBJECT_OT_restrictview_set";
|
2009-01-25 20:22:05 +00:00
|
|
|
|
|
|
|
/* api callbacks */
|
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
|
|
|
ot->exec= object_restrictview_set_exec;
|
|
|
|
ot->poll= ED_operator_view3d_active;
|
2009-01-25 20:22:05 +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
|
|
|
/* flags */
|
|
|
|
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
2009-01-31 19:40:40 +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
|
|
|
RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected objects.");
|
2009-01-25 20:22:05 +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
|
|
|
/* ******************* toggle editmode operator ***************** */
|
|
|
|
|
|
|
|
void ED_object_exit_editmode(bContext *C, int flag)
|
2009-01-25 20:22:05 +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
|
|
|
Scene *scene= CTX_data_scene(C);
|
2009-01-25 20:22:05 +00:00
|
|
|
Object *obedit= CTX_data_edit_object(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
|
|
|
int freedata = flag & EM_FREEDATA;
|
2009-01-26 15:23:29 +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
|
|
|
if(obedit==NULL) return;
|
2009-01-26 15:23:29 +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
|
|
|
if(flag & EM_WAITCURSOR) waitcursor(1);
|
|
|
|
if(obedit->type==OB_MESH) {
|
|
|
|
Mesh *me= obedit->data;
|
|
|
|
|
|
|
|
// if(EM_texFaceCheck())
|
|
|
|
|
|
|
|
// if(retopo_mesh_paint_check())
|
|
|
|
// retopo_end_okee();
|
|
|
|
|
|
|
|
if(me->edit_mesh->totvert>MESH_MAX_VERTS) {
|
|
|
|
error("Too many vertices");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
load_editMesh(scene, obedit);
|
|
|
|
|
|
|
|
if(freedata) {
|
|
|
|
free_editMesh(me->edit_mesh);
|
|
|
|
MEM_freeN(me->edit_mesh);
|
|
|
|
me->edit_mesh= NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(obedit->restore_mode & OB_MODE_WEIGHT_PAINT)
|
|
|
|
mesh_octree_table(obedit, NULL, NULL, 'e');
|
|
|
|
}
|
|
|
|
else if (obedit->type==OB_ARMATURE) {
|
|
|
|
ED_armature_from_edit(obedit);
|
|
|
|
if(freedata)
|
|
|
|
ED_armature_edit_free(obedit);
|
|
|
|
}
|
|
|
|
else if(ELEM(obedit->type, OB_CURVE, OB_SURF)) {
|
|
|
|
load_editNurb(obedit);
|
|
|
|
if(freedata) free_editNurb(obedit);
|
|
|
|
}
|
|
|
|
else if(obedit->type==OB_FONT && freedata) {
|
|
|
|
load_editText(obedit);
|
|
|
|
if(freedata) free_editText(obedit);
|
|
|
|
}
|
|
|
|
else if(obedit->type==OB_LATTICE) {
|
|
|
|
load_editLatt(obedit);
|
|
|
|
if(freedata) free_editLatt(obedit);
|
|
|
|
}
|
|
|
|
else if(obedit->type==OB_MBALL) {
|
|
|
|
load_editMball(obedit);
|
|
|
|
if(freedata) free_editMball(obedit);
|
2009-01-26 15:23:29 +00:00
|
|
|
}
|
2009-02-13 17:37:01 +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
|
|
|
/* freedata only 0 now on file saves */
|
|
|
|
if(freedata) {
|
|
|
|
/* for example; displist make is different in editmode */
|
|
|
|
scene->obedit= NULL; // XXX for context
|
|
|
|
|
|
|
|
BKE_ptcache_object_reset(scene, obedit, PTCACHE_RESET_DEPSGRAPH);
|
2009-01-25 20:22:05 +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
|
|
|
/* also flush ob recalc, doesn't take much overhead, but used for particles */
|
|
|
|
DAG_id_flush_update(&obedit->id, OB_RECALC_OB|OB_RECALC_DATA);
|
2009-02-13 17:37:01 +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
|
|
|
ED_undo_push(C, "Editmode");
|
2009-02-13 17:37:01 +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
|
|
|
if(flag & EM_WAITCURSOR) waitcursor(0);
|
2009-02-13 17:37:01 +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
|
|
|
WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_OBJECT, scene);
|
2009-02-13 17:37:01 +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
|
|
|
|
|
|
|
obedit->mode &= ~OB_MODE_EDIT;
|
|
|
|
ED_object_toggle_modes(C, obedit->restore_mode);
|
2009-02-13 17:37:01 +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
|
|
|
|
|
|
|
void ED_object_enter_editmode(bContext *C, int flag)
|
2009-02-13 17:37:01 +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
|
|
|
Scene *scene= CTX_data_scene(C);
|
|
|
|
Base *base= CTX_data_active_base(C);
|
|
|
|
Object *ob;
|
|
|
|
ScrArea *sa= CTX_wm_area(C);
|
|
|
|
View3D *v3d= NULL;
|
|
|
|
int ok= 0;
|
2009-02-13 17:37:01 +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
|
|
|
if(scene->id.lib) return;
|
|
|
|
if(base==NULL) return;
|
2009-02-13 17:37:01 +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
|
|
|
if(sa && sa->spacetype==SPACE_VIEW3D)
|
|
|
|
v3d= sa->spacedata.first;
|
2009-02-13 17:37:01 +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
|
|
|
if(v3d && (base->lay & v3d->lay)==0) return;
|
|
|
|
else if(!v3d && (base->lay & scene->lay)==0) return;
|
2009-01-25 20:22:05 +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
|
|
|
ob = base->object;
|
2009-07-29 12:35:09 +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
|
|
|
if(ob==NULL) return;
|
|
|
|
if(ob->data==NULL) return;
|
2009-07-29 12:35:09 +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
|
|
|
if (object_data_is_libdata(ob)) {
|
|
|
|
error_libdata();
|
|
|
|
return;
|
2009-07-29 12:35:09 +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
|
|
|
if(flag & EM_WAITCURSOR) waitcursor(1);
|
2009-07-29 12:35:09 +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
|
|
|
ob->restore_mode = ob->mode;
|
|
|
|
ED_object_toggle_modes(C, ob->mode);
|
2009-07-29 12:35:09 +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
|
|
|
ob->mode |= OB_MODE_EDIT;
|
2.5: Text edit mode operators back. Took me a while getting
them nicely repeatable, and splitting up the big edit_text
operator into individual operator so it's all nicely scriptable,
documented, configurable, etc..
* Insert Text, Line Break, Insert Lorem
* Toggle Case, Set Case, Toggle Style, Set Style, Set Material
* Copy Text, Cut Text, Paste Text, Paste File, Paste Buffer
* Move, Move Select, Delete
* Change Spacing, Change Character
Notes
* Text (datablock) to Object doesn't work yet, will need to
implement text editor context for that.
* Some shortcut keys don't work because screen/wm overrides them,
ctrl+x, ctrl+left/right. That override goes top down which works
well for some cases, but here we need to override in the other
direction.
* There's no unicode support in RNA, or the user interface code
for that matter, but text strings can contain these characters.
At the moment it stores a UTF-8 string in char arrays, which is
supposed to be nicely compatible with ascii. Seems reasonable to
add support for UTF-8 in the interface code, python bindings, ..
eventually?
2009-02-17 19:55:20 +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
|
|
|
if(ob->type==OB_MESH) {
|
|
|
|
Mesh *me= ob->data;
|
|
|
|
|
|
|
|
if(me->pv) mesh_pmv_off(ob, me);
|
|
|
|
ok= 1;
|
|
|
|
scene->obedit= ob; // context sees this
|
|
|
|
|
|
|
|
make_editMesh(scene, ob);
|
2.5: Text edit mode operators back. Took me a while getting
them nicely repeatable, and splitting up the big edit_text
operator into individual operator so it's all nicely scriptable,
documented, configurable, etc..
* Insert Text, Line Break, Insert Lorem
* Toggle Case, Set Case, Toggle Style, Set Style, Set Material
* Copy Text, Cut Text, Paste Text, Paste File, Paste Buffer
* Move, Move Select, Delete
* Change Spacing, Change Character
Notes
* Text (datablock) to Object doesn't work yet, will need to
implement text editor context for that.
* Some shortcut keys don't work because screen/wm overrides them,
ctrl+x, ctrl+left/right. That override goes top down which works
well for some cases, but here we need to override in the other
direction.
* There's no unicode support in RNA, or the user interface code
for that matter, but text strings can contain these characters.
At the moment it stores a UTF-8 string in char arrays, which is
supposed to be nicely compatible with ascii. Seems reasonable to
add support for UTF-8 in the interface code, python bindings, ..
eventually?
2009-02-17 19:55:20 +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
|
|
|
WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_EDITMODE_MESH, scene);
|
|
|
|
}
|
|
|
|
else if (ob->type==OB_ARMATURE){
|
|
|
|
bArmature *arm= base->object->data;
|
|
|
|
if (!arm) return;
|
|
|
|
/*
|
|
|
|
* The function object_data_is_libdata make a problem here, the
|
|
|
|
* check for ob->proxy return 0 and let blender enter to edit mode
|
|
|
|
* this causa a crash when you try leave the edit mode.
|
|
|
|
* The problem is that i can't remove the ob->proxy check from
|
|
|
|
* object_data_is_libdata that prevent the bugfix #6614, so
|
|
|
|
* i add this little hack here.
|
|
|
|
*/
|
|
|
|
if(arm->id.lib) {
|
|
|
|
error_libdata();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ok=1;
|
|
|
|
scene->obedit= ob;
|
|
|
|
ED_armature_to_edit(ob);
|
|
|
|
/* to ensure all goes in restposition and without striding */
|
|
|
|
DAG_id_flush_update(&ob->id, OB_RECALC);
|
2.5: Text edit mode operators back. Took me a while getting
them nicely repeatable, and splitting up the big edit_text
operator into individual operator so it's all nicely scriptable,
documented, configurable, etc..
* Insert Text, Line Break, Insert Lorem
* Toggle Case, Set Case, Toggle Style, Set Style, Set Material
* Copy Text, Cut Text, Paste Text, Paste File, Paste Buffer
* Move, Move Select, Delete
* Change Spacing, Change Character
Notes
* Text (datablock) to Object doesn't work yet, will need to
implement text editor context for that.
* Some shortcut keys don't work because screen/wm overrides them,
ctrl+x, ctrl+left/right. That override goes top down which works
well for some cases, but here we need to override in the other
direction.
* There's no unicode support in RNA, or the user interface code
for that matter, but text strings can contain these characters.
At the moment it stores a UTF-8 string in char arrays, which is
supposed to be nicely compatible with ascii. Seems reasonable to
add support for UTF-8 in the interface code, python bindings, ..
eventually?
2009-02-17 19:55:20 +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
|
|
|
WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_EDITMODE_ARMATURE, scene);
|
|
|
|
}
|
|
|
|
else if(ob->type==OB_FONT) {
|
|
|
|
scene->obedit= ob; // XXX for context
|
|
|
|
ok= 1;
|
|
|
|
make_editText(ob);
|
2.5: Text edit mode operators back. Took me a while getting
them nicely repeatable, and splitting up the big edit_text
operator into individual operator so it's all nicely scriptable,
documented, configurable, etc..
* Insert Text, Line Break, Insert Lorem
* Toggle Case, Set Case, Toggle Style, Set Style, Set Material
* Copy Text, Cut Text, Paste Text, Paste File, Paste Buffer
* Move, Move Select, Delete
* Change Spacing, Change Character
Notes
* Text (datablock) to Object doesn't work yet, will need to
implement text editor context for that.
* Some shortcut keys don't work because screen/wm overrides them,
ctrl+x, ctrl+left/right. That override goes top down which works
well for some cases, but here we need to override in the other
direction.
* There's no unicode support in RNA, or the user interface code
for that matter, but text strings can contain these characters.
At the moment it stores a UTF-8 string in char arrays, which is
supposed to be nicely compatible with ascii. Seems reasonable to
add support for UTF-8 in the interface code, python bindings, ..
eventually?
2009-02-17 19:55:20 +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
|
|
|
WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_EDITMODE_TEXT, scene);
|
2009-02-10 22:45:20 +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
|
|
|
else if(ob->type==OB_MBALL) {
|
|
|
|
scene->obedit= ob; // XXX for context
|
|
|
|
ok= 1;
|
|
|
|
make_editMball(ob);
|
2009-02-25 14:50:40 +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
|
|
|
WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_EDITMODE_MBALL, scene);
|
|
|
|
}
|
|
|
|
else if(ob->type==OB_LATTICE) {
|
|
|
|
scene->obedit= ob; // XXX for context
|
|
|
|
ok= 1;
|
|
|
|
make_editLatt(ob);
|
|
|
|
|
|
|
|
WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_EDITMODE_LATTICE, scene);
|
|
|
|
}
|
|
|
|
else if(ob->type==OB_SURF || ob->type==OB_CURVE) {
|
|
|
|
ok= 1;
|
|
|
|
scene->obedit= ob; // XXX for context
|
|
|
|
make_editNurb(ob);
|
|
|
|
|
|
|
|
WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_EDITMODE_CURVE, scene);
|
2009-02-10 22:45:20 +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
|
|
|
if(ok) {
|
|
|
|
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
scene->obedit= NULL; // XXX for context
|
|
|
|
WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_OBJECT, scene);
|
|
|
|
}
|
2009-02-10 22:45:20 +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
|
|
|
if(flag & EM_DO_UNDO) ED_undo_push(C, "Enter Editmode");
|
|
|
|
if(flag & EM_WAITCURSOR) waitcursor(0);
|
2009-02-10 22:45:20 +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
|
|
|
static int editmode_toggle_exec(bContext *C, wmOperator *op)
|
|
|
|
{
|
2009-02-10 22:45:20 +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
|
|
|
if(!CTX_data_edit_object(C))
|
|
|
|
ED_object_enter_editmode(C, EM_WAITCURSOR);
|
|
|
|
else
|
|
|
|
ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR);
|
2009-02-10 22:45:20 +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
|
|
|
return OPERATOR_FINISHED;
|
2009-02-10 22:45:20 +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
|
|
|
static int editmode_toggle_poll(bContext *C)
|
2009-01-25 20:22:05 +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
|
|
|
Object *ob = CTX_data_active_object(C);
|
|
|
|
|
|
|
|
return ob && (ob->type == OB_MESH || ob->type == OB_ARMATURE ||
|
|
|
|
ob->type == OB_FONT || ob->type == OB_MBALL ||
|
|
|
|
ob->type == OB_LATTICE || ob->type == OB_SURF ||
|
|
|
|
ob->type == OB_CURVE);
|
2009-01-25 20:22:05 +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
|
|
|
void OBJECT_OT_editmode_toggle(wmOperatorType *ot)
|
2009-01-25 20:22:05 +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-01-25 20:22:05 +00:00
|
|
|
/* identifiers */
|
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
|
|
|
ot->name= "Toggle Editmode";
|
|
|
|
ot->description = "Toggle object's editmode.";
|
|
|
|
ot->idname= "OBJECT_OT_editmode_toggle";
|
2009-01-25 20:22:05 +00:00
|
|
|
|
|
|
|
/* api callbacks */
|
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
|
|
|
ot->exec= editmode_toggle_exec;
|
2009-01-25 20:22:05 +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
|
|
|
ot->poll= editmode_toggle_poll;
|
2009-01-31 19:40:40 +00:00
|
|
|
|
|
|
|
/* flags */
|
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
|
|
|
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
2009-01-25 20:22:05 +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-01-15 16:07:39 +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
|
|
|
static int posemode_exec(bContext *C, wmOperator *op)
|
2008-12-23 19:47:33 +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
|
|
|
Base *base= CTX_data_active_base(C);
|
2009-02-04 17:40:50 +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
|
|
|
if(base->object->type==OB_ARMATURE) {
|
|
|
|
if(base->object==CTX_data_edit_object(C)) {
|
|
|
|
ED_object_exit_editmode(C, EM_FREEDATA);
|
|
|
|
ED_armature_enter_posemode(C, base);
|
|
|
|
}
|
|
|
|
else if(base->object->mode & OB_MODE_POSE)
|
|
|
|
ED_armature_exit_posemode(C, base);
|
|
|
|
else
|
|
|
|
ED_armature_enter_posemode(C, base);
|
2009-02-04 17:40:50 +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
|
|
|
return OPERATOR_FINISHED;
|
2008-12-23 19:47:33 +00:00
|
|
|
}
|
2009-02-04 17:40:50 +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
|
|
|
return OPERATOR_PASS_THROUGH;
|
2009-02-04 17:40:50 +00:00
|
|
|
}
|
2008-12-23 19:47:33 +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
|
|
|
void OBJECT_OT_posemode_toggle(wmOperatorType *ot)
|
2009-02-04 17:40:50 +00:00
|
|
|
{
|
|
|
|
/* identifiers */
|
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
|
|
|
ot->name= "Toggle Pose Mode";
|
|
|
|
ot->idname= "OBJECT_OT_posemode_toggle";
|
|
|
|
ot->description= "Enables or disables posing/selecting bones";
|
2009-02-04 17:40:50 +00:00
|
|
|
|
|
|
|
/* api callbacks */
|
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
|
|
|
ot->exec= posemode_exec;
|
|
|
|
ot->poll= ED_operator_object_active;
|
2009-02-04 17:40:50 +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
|
|
|
/* flag */
|
|
|
|
ot->flag= OPTYPE_REGISTER;
|
2008-12-23 19:47:33 +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-02-04 17:40:50 +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
|
|
|
void check_editmode(int type)
|
2009-01-15 15:01:39 +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
|
|
|
Object *obedit= NULL; // XXX
|
|
|
|
|
|
|
|
if (obedit==NULL || obedit->type==type) return;
|
2009-01-15 15:01:39 +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
|
|
|
// XXX ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* freedata, and undo */
|
2009-01-15 15:01:39 +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
|
|
|
#if 0
|
|
|
|
// XXX should be in view3d?
|
2009-01-15 15:01:39 +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
|
|
|
/* context: ob = lamp */
|
|
|
|
/* code should be replaced with proper (custom) transform handles for lamp properties */
|
|
|
|
static void spot_interactive(Object *ob, int mode)
|
2009-01-15 15:01:39 +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
|
|
|
Lamp *la= ob->data;
|
|
|
|
float transfac, dx, dy, ratio, origval;
|
|
|
|
int keep_running= 1, center2d[2];
|
|
|
|
short mval[2], mvalo[2];
|
2009-01-15 15:01:39 +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
|
|
|
// getmouseco_areawin(mval);
|
|
|
|
// getmouseco_areawin(mvalo);
|
2009-01-15 15:01:39 +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
|
|
|
project_int(ob->obmat[3], center2d);
|
|
|
|
if( center2d[0] > 100000 ) { /* behind camera */
|
|
|
|
// center2d[0]= curarea->winx/2;
|
|
|
|
// center2d[1]= curarea->winy/2;
|
2009-01-15 15:01:39 +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
|
|
|
// helpline(mval, center2d);
|
2008-12-23 19:47:33 +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
|
|
|
/* ratio is like scaling */
|
|
|
|
dx = (float)(center2d[0] - mval[0]);
|
|
|
|
dy = (float)(center2d[1] - mval[1]);
|
|
|
|
transfac = (float)sqrt( dx*dx + dy*dy);
|
|
|
|
if(transfac==0.0f) transfac= 1.0f;
|
2008-12-23 19:47:33 +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
|
|
|
if(mode==1)
|
|
|
|
origval= la->spotsize;
|
|
|
|
else if(mode==2)
|
|
|
|
origval= la->dist;
|
|
|
|
else if(mode==3)
|
|
|
|
origval= la->clipsta;
|
|
|
|
else
|
|
|
|
origval= la->clipend;
|
2008-12-23 19:47:33 +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
|
|
|
while (keep_running>0) {
|
2008-12-23 19:47:33 +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
|
|
|
// getmouseco_areawin(mval);
|
|
|
|
|
|
|
|
/* essential for idling subloop */
|
|
|
|
if(mval[0]==mvalo[0] && mval[1]==mvalo[1]) {
|
|
|
|
PIL_sleep_ms(2);
|
2008-12-23 19:47:33 +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
|
|
|
else {
|
|
|
|
char str[32];
|
|
|
|
|
|
|
|
dx = (float)(center2d[0] - mval[0]);
|
|
|
|
dy = (float)(center2d[1] - mval[1]);
|
|
|
|
ratio = (float)(sqrt( dx*dx + dy*dy))/transfac;
|
|
|
|
|
|
|
|
/* do the trick */
|
|
|
|
|
|
|
|
if(mode==1) { /* spot */
|
|
|
|
la->spotsize = ratio*origval;
|
|
|
|
CLAMP(la->spotsize, 1.0f, 180.0f);
|
|
|
|
sprintf(str, "Spot size %.2f\n", la->spotsize);
|
|
|
|
}
|
|
|
|
else if(mode==2) { /* dist */
|
|
|
|
la->dist = ratio*origval;
|
|
|
|
CLAMP(la->dist, 0.01f, 5000.0f);
|
|
|
|
sprintf(str, "Distance %.2f\n", la->dist);
|
|
|
|
}
|
|
|
|
else if(mode==3) { /* sta */
|
|
|
|
la->clipsta = ratio*origval;
|
|
|
|
CLAMP(la->clipsta, 0.001f, 5000.0f);
|
|
|
|
sprintf(str, "Distance %.2f\n", la->clipsta);
|
|
|
|
}
|
|
|
|
else if(mode==4) { /* end */
|
|
|
|
la->clipend = ratio*origval;
|
|
|
|
CLAMP(la->clipend, 0.1f, 5000.0f);
|
|
|
|
sprintf(str, "Clip End %.2f\n", la->clipend);
|
|
|
|
}
|
2008-12-23 19:47:33 +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
|
|
|
/* cleanup */
|
|
|
|
mvalo[0]= mval[0];
|
|
|
|
mvalo[1]= mval[1];
|
|
|
|
|
|
|
|
/* handle shaded mode */
|
|
|
|
// XXX shade_buttons_change_3d();
|
2009-03-30 07:28:37 +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
|
|
|
/* DRAW */
|
|
|
|
headerprint(str);
|
|
|
|
force_draw_plus(SPACE_BUTS, 0);
|
2008-12-23 19:47:33 +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
|
|
|
// helpline(mval, center2d);
|
2008-12-23 19:47:33 +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
|
|
|
|
|
|
|
while( qtest() ) {
|
|
|
|
short val;
|
|
|
|
unsigned short event= extern_qread(&val);
|
|
|
|
|
|
|
|
switch (event){
|
|
|
|
case ESCKEY:
|
|
|
|
case RIGHTMOUSE:
|
|
|
|
keep_running= 0;
|
|
|
|
break;
|
|
|
|
case LEFTMOUSE:
|
|
|
|
case SPACEKEY:
|
|
|
|
case PADENTER:
|
|
|
|
case RETKEY:
|
|
|
|
if(val)
|
|
|
|
keep_running= -1;
|
|
|
|
break;
|
2008-12-23 19:47:33 +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
|
|
|
if(keep_running==0) {
|
|
|
|
if(mode==1)
|
|
|
|
la->spotsize= origval;
|
|
|
|
else if(mode==2)
|
|
|
|
la->dist= origval;
|
|
|
|
else if(mode==3)
|
|
|
|
la->clipsta= origval;
|
|
|
|
else
|
|
|
|
la->clipend= origval;
|
2008-12-23 19:47:33 +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
|
|
|
|
2008-12-23 19:47:33 +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
|
|
|
#endif
|
2008-12-23 19:47:33 +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
|
|
|
void special_editmenu(Scene *scene, View3D *v3d)
|
2008-12-23 19:47:33 +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
|
|
|
// XXX static short numcuts= 2;
|
|
|
|
Object *ob= OBACT;
|
|
|
|
Object *obedit= NULL; // XXX
|
|
|
|
int nr,ret=0;
|
2008-12-23 19:47:33 +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
|
|
|
if(ob==NULL) return;
|
2008-12-23 19:47:33 +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
|
|
|
if(obedit==NULL) {
|
|
|
|
|
|
|
|
if(ob->mode & OB_MODE_POSE) {
|
|
|
|
// XXX pose_special_editmenu();
|
|
|
|
}
|
|
|
|
else if(paint_facesel_test(ob)) {
|
|
|
|
Mesh *me= get_mesh(ob);
|
|
|
|
MTFace *tface;
|
|
|
|
MFace *mface;
|
|
|
|
int a;
|
|
|
|
|
|
|
|
if(me==0 || me->mtface==0) return;
|
|
|
|
|
|
|
|
nr= pupmenu("Specials%t|Set Tex%x1| Shared%x2| Light%x3| Invisible%x4| Collision%x5| TwoSide%x6|Clr Tex%x7| Shared%x8| Light%x9| Invisible%x10| Collision%x11| TwoSide%x12");
|
|
|
|
|
|
|
|
tface= me->mtface;
|
|
|
|
mface= me->mface;
|
|
|
|
for(a=me->totface; a>0; a--, tface++, mface++) {
|
|
|
|
if(mface->flag & ME_FACE_SEL) {
|
|
|
|
switch(nr) {
|
|
|
|
case 1:
|
|
|
|
tface->mode |= TF_TEX; break;
|
|
|
|
case 2:
|
|
|
|
tface->mode |= TF_SHAREDCOL; break;
|
|
|
|
case 3:
|
|
|
|
tface->mode |= TF_LIGHT; break;
|
|
|
|
case 4:
|
|
|
|
tface->mode |= TF_INVISIBLE; break;
|
|
|
|
case 5:
|
|
|
|
tface->mode |= TF_DYNAMIC; break;
|
|
|
|
case 6:
|
|
|
|
tface->mode |= TF_TWOSIDE; break;
|
|
|
|
case 7:
|
|
|
|
tface->mode &= ~TF_TEX;
|
|
|
|
tface->tpage= 0;
|
|
|
|
break;
|
|
|
|
case 8:
|
|
|
|
tface->mode &= ~TF_SHAREDCOL; break;
|
|
|
|
case 9:
|
|
|
|
tface->mode &= ~TF_LIGHT; break;
|
|
|
|
case 10:
|
|
|
|
tface->mode &= ~TF_INVISIBLE; break;
|
|
|
|
case 11:
|
|
|
|
tface->mode &= ~TF_DYNAMIC; break;
|
|
|
|
case 12:
|
|
|
|
tface->mode &= ~TF_TWOSIDE; break;
|
|
|
|
}
|
2008-12-23 19:47:33 +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
|
|
|
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
|
2008-12-23 19:47:33 +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
|
|
|
else if(ob->mode & OB_MODE_VERTEX_PAINT) {
|
|
|
|
Mesh *me= get_mesh(ob);
|
|
|
|
|
|
|
|
if(me==0 || (me->mcol==NULL && me->mtface==NULL) ) return;
|
|
|
|
|
|
|
|
nr= pupmenu("Specials%t|Shared VertexCol%x1");
|
|
|
|
if(nr==1) {
|
|
|
|
|
|
|
|
// XXX do_shared_vertexcol(me);
|
|
|
|
|
|
|
|
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
|
2008-12-23 19:47:33 +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
|
|
|
else if(ob->mode & OB_MODE_WEIGHT_PAINT) {
|
|
|
|
Object *par= modifiers_isDeformedByArmature(ob);
|
2008-12-23 19:47:33 +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
|
|
|
if(par && (par->mode & OB_MODE_POSE)) {
|
|
|
|
nr= pupmenu("Specials%t|Apply Bone Envelopes to Vertex Groups %x1|Apply Bone Heat Weights to Vertex Groups %x2");
|
2009-03-30 07:28:37 +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
|
|
|
// XXX if(nr==1 || nr==2)
|
|
|
|
// XXX pose_adds_vgroups(ob, (nr == 2));
|
2009-03-30 07:28:37 +00:00
|
|
|
}
|
2008-12-31 17:11:42 +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
|
|
|
else if(ob->mode & OB_MODE_PARTICLE_EDIT) {
|
|
|
|
#if 0
|
|
|
|
// XXX
|
|
|
|
ParticleSystem *psys = PE_get_current(ob);
|
|
|
|
ParticleEditSettings *pset = PE_settings();
|
2008-12-23 19:47:33 +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
|
|
|
if(!psys)
|
2008-12-23 19:47:33 +00:00
|
|
|
return;
|
|
|
|
|
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
|
|
|
if(pset->selectmode & SCE_SELECT_POINT)
|
|
|
|
nr= pupmenu("Specials%t|Rekey%x1|Subdivide%x2|Select First%x3|Select Last%x4|Remove Doubles%x5");
|
|
|
|
else
|
|
|
|
nr= pupmenu("Specials%t|Rekey%x1|Remove Doubles%x5");
|
2008-12-23 19:47:33 +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
|
|
|
switch(nr) {
|
|
|
|
case 1:
|
|
|
|
// XXX if(button(&pset->totrekey, 2, 100, "Number of Keys:")==0) return;
|
|
|
|
waitcursor(1);
|
|
|
|
PE_rekey();
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
PE_subdivide();
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
PE_select_root();
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
PE_select_tip();
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
PE_remove_doubles();
|
|
|
|
break;
|
2008-12-23 19:47:33 +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
|
|
|
|
|
|
|
DAG_id_flush_update(&obedit->id, OB_RECALC_DATA);
|
|
|
|
|
|
|
|
if(nr>0) waitcursor(0);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
Base *base, *base_select= NULL;
|
|
|
|
|
|
|
|
/* Get the active object mesh. */
|
|
|
|
Mesh *me= get_mesh(ob);
|
|
|
|
|
|
|
|
/* Booleans, if the active object is a mesh... */
|
|
|
|
if (me && ob->id.lib==NULL) {
|
2008-12-23 19:47:33 +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
|
|
|
/* Bring up a little menu with the boolean operation choices on. */
|
|
|
|
nr= pupmenu("Boolean Tools%t|Intersect%x1|Union%x2|Difference%x3|Add Intersect Modifier%x4|Add Union Modifier%x5|Add Difference Modifier%x6");
|
|
|
|
|
|
|
|
if (nr > 0) {
|
|
|
|
/* user has made a choice of a menu element.
|
|
|
|
All of the boolean functions require 2 mesh objects
|
|
|
|
we search through the object list to find the other
|
|
|
|
selected item and make sure it is distinct and a mesh. */
|
|
|
|
|
|
|
|
for(base= FIRSTBASE; base; base= base->next) {
|
|
|
|
if(TESTBASELIB(v3d, base)) {
|
|
|
|
if(base->object != ob) base_select= base;
|
2008-12-23 19:47:33 +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
|
|
|
|
|
|
|
if (base_select) {
|
|
|
|
if (get_mesh(base_select->object)) {
|
|
|
|
if(nr <= 3){
|
|
|
|
waitcursor(1);
|
|
|
|
// XXX ret = NewBooleanMesh(BASACT,base_select,nr);
|
|
|
|
if (ret==0) {
|
|
|
|
error("An internal error occurred");
|
|
|
|
} else if(ret==-1) {
|
|
|
|
error("Selected meshes must have faces to perform boolean operations");
|
|
|
|
} else if (ret==-2) {
|
|
|
|
error("Both meshes must be a closed mesh");
|
|
|
|
}
|
|
|
|
waitcursor(0);
|
|
|
|
} else {
|
|
|
|
BooleanModifierData *bmd = NULL;
|
|
|
|
bmd = (BooleanModifierData *)modifier_new(eModifierType_Boolean);
|
|
|
|
BLI_addtail(&ob->modifiers, bmd);
|
|
|
|
bmd->object = base_select->object;
|
|
|
|
bmd->modifier.mode |= eModifierMode_Realtime;
|
|
|
|
switch(nr){
|
|
|
|
case 4: bmd->operation = eBooleanModifierOp_Intersect; break;
|
|
|
|
case 5: bmd->operation = eBooleanModifierOp_Union; break;
|
|
|
|
case 6: bmd->operation = eBooleanModifierOp_Difference; break;
|
|
|
|
}
|
|
|
|
// XXX do_common_editbuts(B_CHANGEDEP);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
error("Please select 2 meshes");
|
2008-12-23 19:47:33 +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
|
|
|
} else {
|
|
|
|
error("Please select 2 meshes");
|
2008-12-23 19:47:33 +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
|
|
|
|
2008-12-23 19:47:33 +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
|
|
|
else if (ob->type == OB_FONT) {
|
|
|
|
/* removed until this gets a decent implementation (ton) */
|
|
|
|
/* nr= pupmenu("Split %t|Characters%x1");
|
|
|
|
if (nr > 0) {
|
|
|
|
switch(nr) {
|
|
|
|
case 1: split_font();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
}
|
2008-12-23 19:47:33 +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
|
|
|
else if(obedit->type==OB_MESH) {
|
|
|
|
}
|
|
|
|
else if(ELEM(obedit->type, OB_CURVE, OB_SURF)) {
|
|
|
|
}
|
|
|
|
else if(obedit->type==OB_ARMATURE) {
|
|
|
|
nr= pupmenu("Specials%t|Subdivide %x1|Subdivide Multi%x2|Switch Direction%x7|Flip Left-Right Names%x3|%l|AutoName Left-Right%x4|AutoName Front-Back%x5|AutoName Top-Bottom%x6");
|
|
|
|
// if(nr==1)
|
|
|
|
// XXX subdivide_armature(1);
|
|
|
|
if(nr==2) {
|
|
|
|
// XXX if(button(&numcuts, 1, 128, "Number of Cuts:")==0) return;
|
|
|
|
waitcursor(1);
|
|
|
|
// XXX subdivide_armature(numcuts);
|
|
|
|
}
|
|
|
|
// else if(nr==3)
|
|
|
|
// XXX armature_flip_names();
|
|
|
|
else if(ELEM3(nr, 4, 5, 6)) {
|
|
|
|
// XXX armature_autoside_names(nr-4);
|
|
|
|
}
|
|
|
|
// else if(nr == 7)
|
|
|
|
// XXX switch_direction_armature();
|
|
|
|
}
|
|
|
|
else if(obedit->type==OB_LATTICE) {
|
|
|
|
Lattice *lt= obedit->data;
|
|
|
|
static float weight= 1.0f;
|
|
|
|
{ // XXX
|
|
|
|
// XXX if(fbutton(&weight, 0.0f, 1.0f, 10, 10, "Set Weight")) {
|
|
|
|
int a= lt->editlatt->pntsu*lt->editlatt->pntsv*lt->editlatt->pntsw;
|
|
|
|
BPoint *bp= lt->editlatt->def;
|
|
|
|
|
|
|
|
while(a--) {
|
|
|
|
if(bp->f1 & SELECT)
|
|
|
|
bp->weight= weight;
|
|
|
|
bp++;
|
|
|
|
}
|
|
|
|
}
|
2008-12-23 19:47:33 +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
|
|
|
/* Change subdivision or particle properties of mesh object ob, if level==-1
|
|
|
|
* then toggle subsurf, else set to level set allows to toggle multiple
|
|
|
|
* selections */
|
2008-12-23 19:47:33 +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
|
|
|
static void object_has_subdivision_particles(Object *ob, int *havesubdiv, int *havepart, int depth)
|
2008-12-23 19:47:33 +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
|
|
|
if(ob->type==OB_MESH) {
|
|
|
|
if(modifiers_findByType(ob, eModifierType_Subsurf))
|
|
|
|
*havesubdiv= 1;
|
|
|
|
if(modifiers_findByType(ob, eModifierType_ParticleSystem))
|
|
|
|
*havepart= 1;
|
2008-12-23 19:47:33 +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
|
|
|
|
|
|
|
if(ob->dup_group && depth <= 4) {
|
|
|
|
GroupObject *go;
|
|
|
|
|
|
|
|
for(go= ob->dup_group->gobject.first; go; go= go->next)
|
|
|
|
object_has_subdivision_particles(go->ob, havesubdiv, havepart, depth+1);
|
2008-12-23 19:47:33 +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
|
|
|
static void object_flip_subdivison_particles(Scene *scene, Object *ob, int *set, int level, int mode, int particles, int depth)
|
|
|
|
{
|
|
|
|
ModifierData *md;
|
2008-12-23 19:47:33 +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
|
|
|
if(ob->type==OB_MESH) {
|
|
|
|
if(particles) {
|
|
|
|
for(md=ob->modifiers.first; md; md=md->next) {
|
|
|
|
if(md->type == eModifierType_ParticleSystem) {
|
|
|
|
ParticleSystemModifierData *psmd = (ParticleSystemModifierData*)md;
|
2008-12-23 19:47:33 +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
|
|
|
if(*set == -1)
|
|
|
|
*set= psmd->modifier.mode&(mode);
|
2008-12-23 19:47:33 +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
|
|
|
if (*set)
|
|
|
|
psmd->modifier.mode &= ~(mode);
|
|
|
|
else
|
|
|
|
psmd->modifier.mode |= (mode);
|
|
|
|
}
|
2008-12-23 19:47:33 +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
|
|
|
else {
|
|
|
|
md = modifiers_findByType(ob, eModifierType_Subsurf);
|
|
|
|
|
|
|
|
if (md) {
|
|
|
|
SubsurfModifierData *smd = (SubsurfModifierData*) md;
|
|
|
|
|
|
|
|
if (level == -1) {
|
|
|
|
if(*set == -1)
|
|
|
|
*set= smd->modifier.mode&(mode);
|
|
|
|
|
|
|
|
if (*set)
|
|
|
|
smd->modifier.mode &= ~(mode);
|
|
|
|
else
|
|
|
|
smd->modifier.mode |= (mode);
|
|
|
|
} else {
|
|
|
|
smd->levels = level;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(depth == 0 && *set != 0) {
|
|
|
|
SubsurfModifierData *smd = (SubsurfModifierData*) modifier_new(eModifierType_Subsurf);
|
|
|
|
|
|
|
|
BLI_addtail(&ob->modifiers, smd);
|
|
|
|
|
|
|
|
if (level!=-1) {
|
|
|
|
smd->levels = level;
|
2008-12-23 19:47:33 +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
|
|
|
|
|
|
|
if(*set == -1)
|
|
|
|
*set= 1;
|
2008-12-23 19:47:33 +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
|
|
|
|
|
|
|
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
|
2008-12-23 19:47:33 +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
|
|
|
if(ob->dup_group && depth<=4) {
|
|
|
|
GroupObject *go;
|
2008-12-23 19:47:33 +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
|
|
|
for(go= ob->dup_group->gobject.first; go; go= go->next)
|
|
|
|
object_flip_subdivison_particles(scene, go->ob, set, level, mode, particles, depth+1);
|
2008-12-23 19:47:33 +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
|
|
|
/* Change subdivision properties of mesh object ob, if
|
|
|
|
* level==-1 then toggle subsurf, else set to level.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void flip_subdivison(Scene *scene, View3D *v3d, int level)
|
2008-12-23 19:47:33 +00:00
|
|
|
{
|
|
|
|
Base *base;
|
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
|
|
|
int set= -1;
|
|
|
|
int mode, pupmode, particles= 0, havesubdiv= 0, havepart= 0;
|
|
|
|
int alt= 0; // XXX
|
|
|
|
|
|
|
|
if(alt)
|
|
|
|
mode= eModifierMode_Realtime;
|
|
|
|
else
|
|
|
|
mode= eModifierMode_Render|eModifierMode_Realtime;
|
|
|
|
|
|
|
|
if(level == -1) {
|
|
|
|
if (scene->obedit) { // XXX get from context
|
|
|
|
object_has_subdivision_particles(scene->obedit, &havesubdiv, &havepart, 0);
|
|
|
|
} else {
|
|
|
|
for(base= scene->base.first; base; base= base->next) {
|
|
|
|
if(((level==-1) && (TESTBASE(v3d, base))) || (TESTBASELIB(v3d, base))) {
|
|
|
|
object_has_subdivision_particles(base->object, &havesubdiv, &havepart, 0);
|
2008-12-23 19:47:33 +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
|
|
|
else
|
|
|
|
havesubdiv= 1;
|
2008-12-23 19:47:33 +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
|
|
|
if(havesubdiv && havepart) {
|
|
|
|
pupmode= pupmenu("Switch%t|Subsurf %x1|Particle Systems %x2");
|
|
|
|
if(pupmode <= 0)
|
|
|
|
return;
|
|
|
|
else if(pupmode == 2)
|
|
|
|
particles= 1;
|
2008-12-23 19:47:33 +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
|
|
|
else if(havepart)
|
|
|
|
particles= 1;
|
2008-12-23 19:47:33 +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
|
|
|
if (scene->obedit) { // XXX get from context
|
|
|
|
object_flip_subdivison_particles(scene, scene->obedit, &set, level, mode, particles, 0);
|
|
|
|
} else {
|
|
|
|
for(base= scene->base.first; base; base= base->next) {
|
|
|
|
if(((level==-1) && (TESTBASE(v3d, base))) || (TESTBASELIB(v3d, base))) {
|
|
|
|
object_flip_subdivison_particles(scene, base->object, &set, level, mode, particles, 0);
|
2008-12-23 19:47:33 +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
|
|
|
|
|
|
|
ED_anim_dag_flush_update(C);
|
2008-12-23 19:47:33 +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
|
|
|
|
|
|
|
static void copymenu_properties(Scene *scene, View3D *v3d, Object *ob)
|
|
|
|
{
|
|
|
|
bProperty *prop;
|
2008-12-23 19:47:33 +00:00
|
|
|
Base *base;
|
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
|
|
|
int nr, tot=0;
|
|
|
|
char *str;
|
2008-12-23 19:47:33 +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
|
|
|
prop= ob->prop.first;
|
|
|
|
while(prop) {
|
|
|
|
tot++;
|
|
|
|
prop= prop->next;
|
|
|
|
}
|
2008-12-23 19:47:33 +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
|
|
|
str= MEM_callocN(50 + 33*tot, "copymenu prop");
|
2008-12-23 19:47:33 +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
|
|
|
if (tot)
|
|
|
|
strcpy(str, "Copy Property %t|Replace All|Merge All|%l");
|
|
|
|
else
|
|
|
|
strcpy(str, "Copy Property %t|Clear All (no properties on active)");
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +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
|
|
|
tot= 0;
|
|
|
|
prop= ob->prop.first;
|
|
|
|
while(prop) {
|
|
|
|
tot++;
|
|
|
|
strcat(str, "|");
|
|
|
|
strcat(str, prop->name);
|
|
|
|
prop= prop->next;
|
2008-12-23 19:47:33 +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
|
|
|
nr= pupmenu(str);
|
2008-12-23 19:47:33 +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
|
|
|
if ( nr==1 || nr==2 ) {
|
|
|
|
for(base= FIRSTBASE; base; base= base->next) {
|
|
|
|
if((base != BASACT) &&(TESTBASELIB(v3d, base))) {
|
|
|
|
if (nr==1) { /* replace */
|
|
|
|
copy_properties( &base->object->prop, &ob->prop );
|
|
|
|
} else {
|
|
|
|
for(prop = ob->prop.first; prop; prop= prop->next ) {
|
|
|
|
set_ob_property(base->object, prop);
|
|
|
|
}
|
2008-12-23 19:47:33 +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
|
|
|
} else if(nr>0) {
|
|
|
|
prop = BLI_findlink(&ob->prop, nr-4); /* account for first 3 menu items & menu index starting at 1*/
|
|
|
|
|
|
|
|
if(prop) {
|
|
|
|
for(base= FIRSTBASE; base; base= base->next) {
|
|
|
|
if((base != BASACT) &&(TESTBASELIB(v3d, base))) {
|
|
|
|
set_ob_property(base->object, prop);
|
2008-12-23 19:47:33 +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
|
|
|
MEM_freeN(str);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static void copymenu_logicbricks(Scene *scene, View3D *v3d, Object *ob)
|
|
|
|
{
|
|
|
|
Base *base;
|
|
|
|
|
|
|
|
for(base= FIRSTBASE; base; base= base->next) {
|
|
|
|
if(base->object != ob) {
|
|
|
|
if(TESTBASELIB(v3d, base)) {
|
|
|
|
|
|
|
|
/* first: free all logic */
|
|
|
|
free_sensors(&base->object->sensors);
|
|
|
|
unlink_controllers(&base->object->controllers);
|
|
|
|
free_controllers(&base->object->controllers);
|
|
|
|
unlink_actuators(&base->object->actuators);
|
|
|
|
free_actuators(&base->object->actuators);
|
|
|
|
|
|
|
|
/* now copy it, this also works without logicbricks! */
|
|
|
|
clear_sca_new_poins_ob(ob);
|
|
|
|
copy_sensors(&base->object->sensors, &ob->sensors);
|
|
|
|
copy_controllers(&base->object->controllers, &ob->controllers);
|
|
|
|
copy_actuators(&base->object->actuators, &ob->actuators);
|
|
|
|
set_sca_new_poins_ob(base->object);
|
|
|
|
|
|
|
|
/* some menu settings */
|
|
|
|
base->object->scavisflag= ob->scavisflag;
|
|
|
|
base->object->scaflag= ob->scaflag;
|
|
|
|
|
|
|
|
/* set the initial state */
|
|
|
|
base->object->state= ob->state;
|
|
|
|
base->object->init_state= ob->init_state;
|
2008-12-23 19:47:33 +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
|
|
|
static void copymenu_modifiers(Scene *scene, View3D *v3d, Object *ob)
|
2008-12-23 19:47:33 +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
|
|
|
Base *base;
|
|
|
|
int i, event;
|
|
|
|
char str[512];
|
|
|
|
char *errorstr= NULL;
|
2008-12-23 19:47:33 +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
|
|
|
strcpy(str, "Copy Modifiers %t");
|
2008-12-23 19:47:33 +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
|
|
|
sprintf(str+strlen(str), "|All%%x%d|%%l", NUM_MODIFIER_TYPES);
|
2008-12-23 19:47:33 +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
|
|
|
for (i=eModifierType_None+1; i<NUM_MODIFIER_TYPES; i++) {
|
|
|
|
ModifierTypeInfo *mti = modifierType_getInfo(i);
|
2008-12-23 19:47:33 +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
|
|
|
if(ELEM3(i, eModifierType_Hook, eModifierType_Softbody, eModifierType_ParticleInstance)) continue;
|
|
|
|
|
|
|
|
if(i == eModifierType_Collision)
|
|
|
|
continue;
|
2008-12-23 19:47:33 +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
|
|
|
if ( (mti->flags&eModifierTypeFlag_AcceptsCVs) ||
|
|
|
|
(ob->type==OB_MESH && (mti->flags&eModifierTypeFlag_AcceptsMesh))) {
|
|
|
|
sprintf(str+strlen(str), "|%s%%x%d", mti->name, i);
|
2008-12-23 19:47:33 +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
|
|
|
event = pupmenu(str);
|
|
|
|
if(event<=0) return;
|
2008-12-23 19:47:33 +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
|
|
|
for (base= FIRSTBASE; base; base= base->next) {
|
|
|
|
if(base->object != ob) {
|
|
|
|
if(TESTBASELIB(v3d, base)) {
|
|
|
|
ModifierData *md;
|
|
|
|
|
|
|
|
base->object->recalc |= OB_RECALC_OB|OB_RECALC_DATA;
|
|
|
|
|
|
|
|
if (base->object->type==ob->type) {
|
|
|
|
/* copy all */
|
|
|
|
if (event==NUM_MODIFIER_TYPES) {
|
|
|
|
object_free_modifiers(base->object);
|
|
|
|
|
|
|
|
for (md=ob->modifiers.first; md; md=md->next) {
|
|
|
|
ModifierData *nmd = NULL;
|
|
|
|
|
|
|
|
if(ELEM3(md->type, eModifierType_Hook, eModifierType_Softbody, eModifierType_ParticleInstance)) continue;
|
|
|
|
|
|
|
|
if(md->type == eModifierType_Collision)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
nmd = modifier_new(md->type);
|
|
|
|
modifier_copyData(md, nmd);
|
|
|
|
BLI_addtail(&base->object->modifiers, nmd);
|
|
|
|
}
|
|
|
|
|
|
|
|
copy_object_particlesystems(base->object, ob);
|
|
|
|
copy_object_softbody(base->object, ob);
|
|
|
|
} else {
|
|
|
|
/* copy specific types */
|
|
|
|
ModifierData *md, *mdn;
|
|
|
|
|
|
|
|
/* remove all with type 'event' */
|
|
|
|
for (md=base->object->modifiers.first; md; md=mdn) {
|
|
|
|
mdn= md->next;
|
|
|
|
if(md->type==event) {
|
|
|
|
BLI_remlink(&base->object->modifiers, md);
|
|
|
|
modifier_free(md);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* copy all with type 'event' */
|
|
|
|
for (md=ob->modifiers.first; md; md=md->next) {
|
|
|
|
if (md->type==event) {
|
|
|
|
|
|
|
|
mdn = modifier_new(event);
|
|
|
|
BLI_addtail(&base->object->modifiers, mdn);
|
|
|
|
|
|
|
|
modifier_copyData(md, mdn);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(event == eModifierType_ParticleSystem) {
|
|
|
|
object_free_particlesystems(base->object);
|
|
|
|
copy_object_particlesystems(base->object, ob);
|
|
|
|
}
|
|
|
|
else if(event == eModifierType_Softbody) {
|
|
|
|
object_free_softbody(base->object);
|
|
|
|
copy_object_softbody(base->object, ob);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
errorstr= "Did not copy modifiers to other Object types";
|
|
|
|
}
|
2008-12-23 19:47:33 +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
|
|
|
|
|
|
|
// if(errorstr) notice(errorstr);
|
|
|
|
|
|
|
|
DAG_scene_sort(scene);
|
|
|
|
|
2008-12-23 19:47:33 +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
|
|
|
/* both pointers should exist */
|
|
|
|
static void copy_texture_space(Object *to, Object *ob)
|
2008-12-23 19:47:33 +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
|
|
|
float *poin1= NULL, *poin2= NULL;
|
|
|
|
int texflag= 0;
|
2008-12-23 19:47:33 +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
|
|
|
if(ob->type==OB_MESH) {
|
|
|
|
texflag= ((Mesh *)ob->data)->texflag;
|
|
|
|
poin2= ((Mesh *)ob->data)->loc;
|
|
|
|
}
|
|
|
|
else if (ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
|
|
|
|
texflag= ((Curve *)ob->data)->texflag;
|
|
|
|
poin2= ((Curve *)ob->data)->loc;
|
|
|
|
}
|
|
|
|
else if(ob->type==OB_MBALL) {
|
|
|
|
texflag= ((MetaBall *)ob->data)->texflag;
|
|
|
|
poin2= ((MetaBall *)ob->data)->loc;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return;
|
|
|
|
|
|
|
|
if(to->type==OB_MESH) {
|
|
|
|
((Mesh *)to->data)->texflag= texflag;
|
|
|
|
poin1= ((Mesh *)to->data)->loc;
|
|
|
|
}
|
|
|
|
else if (ELEM3(to->type, OB_CURVE, OB_SURF, OB_FONT)) {
|
|
|
|
((Curve *)to->data)->texflag= texflag;
|
|
|
|
poin1= ((Curve *)to->data)->loc;
|
|
|
|
}
|
|
|
|
else if(to->type==OB_MBALL) {
|
|
|
|
((MetaBall *)to->data)->texflag= texflag;
|
|
|
|
poin1= ((MetaBall *)to->data)->loc;
|
2008-12-23 19:47:33 +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
|
|
|
else
|
|
|
|
return;
|
2008-12-23 19:47:33 +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
|
|
|
memcpy(poin1, poin2, 9*sizeof(float)); /* this was noted in DNA_mesh, curve, mball */
|
|
|
|
|
|
|
|
if(to->type==OB_MESH) ;
|
|
|
|
else if(to->type==OB_MBALL) tex_space_mball(to);
|
|
|
|
else tex_space_curve(to->data);
|
2008-12-23 19:47:33 +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
|
|
|
void copy_attr(Scene *scene, View3D *v3d, short event)
|
2008-12-23 19:47:33 +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
|
|
|
Base *base;
|
|
|
|
Curve *cu, *cu1;
|
|
|
|
Nurb *nu;
|
|
|
|
int do_scene_sort= 0;
|
2008-12-23 19:47:33 +00:00
|
|
|
|
|
|
|
if(scene->id.lib) return;
|
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
|
|
|
|
|
|
|
if(!(ob=OBACT)) return;
|
2008-12-23 19:47:33 +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
|
|
|
if(scene->obedit) { // XXX get from context
|
|
|
|
/* obedit_copymenu(); */
|
2008-12-23 19:47:33 +00:00
|
|
|
return;
|
|
|
|
}
|
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
|
|
|
if(event==9) {
|
|
|
|
copymenu_properties(scene, v3d, ob);
|
|
|
|
return;
|
2008-12-23 19:47:33 +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
|
|
|
else if(event==10) {
|
|
|
|
copymenu_logicbricks(scene, v3d, ob);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if(event==24) {
|
|
|
|
copymenu_modifiers(scene, v3d, ob);
|
|
|
|
return;
|
2008-12-23 19:47:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for(base= FIRSTBASE; base; base= base->next) {
|
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
|
|
|
if(base != BASACT) {
|
|
|
|
if(TESTBASELIB(v3d, base)) {
|
|
|
|
base->object->recalc |= OB_RECALC_OB;
|
2008-12-23 19:47:33 +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
|
|
|
if(event==1) { /* loc */
|
|
|
|
VECCOPY(base->object->loc, ob->loc);
|
|
|
|
VECCOPY(base->object->dloc, ob->dloc);
|
2008-12-23 19:47:33 +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
|
|
|
else if(event==2) { /* rot */
|
|
|
|
VECCOPY(base->object->rot, ob->rot);
|
|
|
|
VECCOPY(base->object->drot, ob->drot);
|
|
|
|
/* Quats arnt used yet */
|
|
|
|
/*VECCOPY(base->object->quat, ob->quat);
|
|
|
|
VECCOPY(base->object->dquat, ob->dquat);*/
|
2008-12-23 19:47:33 +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
|
|
|
else if(event==3) { /* size */
|
|
|
|
VECCOPY(base->object->size, ob->size);
|
|
|
|
VECCOPY(base->object->dsize, ob->dsize);
|
2008-12-23 19:47:33 +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
|
|
|
else if(event==4) { /* drawtype */
|
|
|
|
base->object->dt= ob->dt;
|
|
|
|
base->object->dtx= ob->dtx;
|
|
|
|
base->object->empty_drawtype= ob->empty_drawtype;
|
|
|
|
base->object->empty_drawsize= ob->empty_drawsize;
|
|
|
|
}
|
|
|
|
else if(event==5) { /* time offs */
|
|
|
|
base->object->sf= ob->sf;
|
|
|
|
}
|
|
|
|
else if(event==6) { /* dupli */
|
|
|
|
base->object->dupon= ob->dupon;
|
|
|
|
base->object->dupoff= ob->dupoff;
|
|
|
|
base->object->dupsta= ob->dupsta;
|
|
|
|
base->object->dupend= ob->dupend;
|
|
|
|
|
|
|
|
base->object->transflag &= ~OB_DUPLI;
|
|
|
|
base->object->transflag |= (ob->transflag & OB_DUPLI);
|
2008-12-23 19:47:33 +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
|
|
|
base->object->dup_group= ob->dup_group;
|
|
|
|
if(ob->dup_group)
|
|
|
|
id_us_plus((ID *)ob->dup_group);
|
2009-01-17 18:35:33 +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
|
|
|
else if(event==7) { /* mass */
|
|
|
|
base->object->mass= ob->mass;
|
2008-12-23 19:47:33 +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
|
|
|
else if(event==8) { /* damping */
|
|
|
|
base->object->damping= ob->damping;
|
|
|
|
base->object->rdamping= ob->rdamping;
|
2009-01-17 18:35:33 +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
|
|
|
else if(event==11) { /* all physical attributes */
|
|
|
|
base->object->gameflag = ob->gameflag;
|
|
|
|
base->object->inertia = ob->inertia;
|
|
|
|
base->object->formfactor = ob->formfactor;
|
|
|
|
base->object->damping= ob->damping;
|
|
|
|
base->object->rdamping= ob->rdamping;
|
|
|
|
base->object->min_vel= ob->min_vel;
|
|
|
|
base->object->max_vel= ob->max_vel;
|
|
|
|
if (ob->gameflag & OB_BOUNDS) {
|
|
|
|
base->object->boundtype = ob->boundtype;
|
|
|
|
}
|
|
|
|
base->object->margin= ob->margin;
|
|
|
|
base->object->bsoft= copy_bulletsoftbody(ob->bsoft);
|
|
|
|
|
2009-08-29 23:41:09 +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
|
|
|
else if(event==17) { /* tex space */
|
|
|
|
copy_texture_space(base->object, ob);
|
|
|
|
}
|
|
|
|
else if(event==18) { /* font settings */
|
|
|
|
|
|
|
|
if(base->object->type==ob->type) {
|
|
|
|
cu= ob->data;
|
|
|
|
cu1= base->object->data;
|
|
|
|
|
|
|
|
cu1->spacemode= cu->spacemode;
|
|
|
|
cu1->spacing= cu->spacing;
|
|
|
|
cu1->linedist= cu->linedist;
|
|
|
|
cu1->shear= cu->shear;
|
|
|
|
cu1->fsize= cu->fsize;
|
|
|
|
cu1->xof= cu->xof;
|
|
|
|
cu1->yof= cu->yof;
|
|
|
|
cu1->textoncurve= cu->textoncurve;
|
|
|
|
cu1->wordspace= cu->wordspace;
|
|
|
|
cu1->ulpos= cu->ulpos;
|
|
|
|
cu1->ulheight= cu->ulheight;
|
|
|
|
if(cu1->vfont) cu1->vfont->id.us--;
|
|
|
|
cu1->vfont= cu->vfont;
|
|
|
|
id_us_plus((ID *)cu1->vfont);
|
|
|
|
if(cu1->vfontb) cu1->vfontb->id.us--;
|
|
|
|
cu1->vfontb= cu->vfontb;
|
|
|
|
id_us_plus((ID *)cu1->vfontb);
|
|
|
|
if(cu1->vfonti) cu1->vfonti->id.us--;
|
|
|
|
cu1->vfonti= cu->vfonti;
|
|
|
|
id_us_plus((ID *)cu1->vfonti);
|
|
|
|
if(cu1->vfontbi) cu1->vfontbi->id.us--;
|
|
|
|
cu1->vfontbi= cu->vfontbi;
|
|
|
|
id_us_plus((ID *)cu1->vfontbi);
|
|
|
|
|
|
|
|
BKE_text_to_curve(scene, base->object, 0); /* needed? */
|
|
|
|
|
|
|
|
|
|
|
|
strcpy(cu1->family, cu->family);
|
|
|
|
|
|
|
|
base->object->recalc |= OB_RECALC_DATA;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(event==19) { /* bevel settings */
|
|
|
|
|
|
|
|
if(ELEM(base->object->type, OB_CURVE, OB_FONT)) {
|
|
|
|
cu= ob->data;
|
|
|
|
cu1= base->object->data;
|
2009-01-17 18:35:33 +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
|
|
|
cu1->bevobj= cu->bevobj;
|
|
|
|
cu1->taperobj= cu->taperobj;
|
|
|
|
cu1->width= cu->width;
|
|
|
|
cu1->bevresol= cu->bevresol;
|
|
|
|
cu1->ext1= cu->ext1;
|
|
|
|
cu1->ext2= cu->ext2;
|
2009-01-17 18:35:33 +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
|
|
|
base->object->recalc |= OB_RECALC_DATA;
|
2008-12-23 19:47:33 +00:00
|
|
|
}
|
2009-01-17 18:35:33 +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
|
|
|
else if(event==25) { /* curve resolution */
|
|
|
|
|
|
|
|
if(ELEM(base->object->type, OB_CURVE, OB_FONT)) {
|
|
|
|
cu= ob->data;
|
|
|
|
cu1= base->object->data;
|
|
|
|
|
|
|
|
cu1->resolu= cu->resolu;
|
|
|
|
cu1->resolu_ren= cu->resolu_ren;
|
|
|
|
|
|
|
|
nu= cu1->nurb.first;
|
|
|
|
|
|
|
|
while(nu) {
|
|
|
|
nu->resolu= cu1->resolu;
|
|
|
|
nu= nu->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
base->object->recalc |= OB_RECALC_DATA;
|
2008-12-23 19:47:33 +00:00
|
|
|
}
|
2009-01-17 18:35:33 +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
|
|
|
else if(event==21){
|
|
|
|
if (base->object->type==OB_MESH) {
|
|
|
|
ModifierData *md = modifiers_findByType(ob, eModifierType_Subsurf);
|
|
|
|
|
|
|
|
if (md) {
|
|
|
|
ModifierData *tmd = modifiers_findByType(base->object, eModifierType_Subsurf);
|
|
|
|
|
|
|
|
if (!tmd) {
|
|
|
|
tmd = modifier_new(eModifierType_Subsurf);
|
|
|
|
BLI_addtail(&base->object->modifiers, tmd);
|
|
|
|
}
|
|
|
|
|
|
|
|
modifier_copyData(md, tmd);
|
|
|
|
base->object->recalc |= OB_RECALC_DATA;
|
|
|
|
}
|
2008-12-23 19:47:33 +00:00
|
|
|
}
|
2009-01-17 18:35:33 +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
|
|
|
else if(event==22) {
|
|
|
|
/* Copy the constraint channels over */
|
|
|
|
copy_constraints(&base->object->constraints, &ob->constraints);
|
|
|
|
|
|
|
|
do_scene_sort= 1;
|
2009-01-17 18:35:33 +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
|
|
|
else if(event==23) {
|
|
|
|
base->object->softflag= ob->softflag;
|
|
|
|
if(base->object->soft) sbFree(base->object->soft);
|
|
|
|
|
|
|
|
base->object->soft= copy_softbody(ob->soft);
|
|
|
|
|
|
|
|
if (!modifiers_findByType(base->object, eModifierType_Softbody)) {
|
|
|
|
BLI_addhead(&base->object->modifiers, modifier_new(eModifierType_Softbody));
|
2008-12-23 19:47:33 +00:00
|
|
|
}
|
2009-01-17 18:35:33 +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
|
|
|
else if(event==26) {
|
|
|
|
#if 0 // XXX old animation system
|
|
|
|
copy_nlastrips(&base->object->nlastrips, &ob->nlastrips);
|
|
|
|
#endif // XXX old animation system
|
2009-01-17 18:35:33 +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
|
|
|
else if(event==27) { /* autosmooth */
|
|
|
|
if (base->object->type==OB_MESH) {
|
|
|
|
Mesh *me= ob->data;
|
|
|
|
Mesh *cme= base->object->data;
|
|
|
|
cme->smoothresh= me->smoothresh;
|
|
|
|
if(me->flag & ME_AUTOSMOOTH)
|
|
|
|
cme->flag |= ME_AUTOSMOOTH;
|
|
|
|
else
|
|
|
|
cme->flag &= ~ME_AUTOSMOOTH;
|
2008-12-23 19:47:33 +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
|
|
|
}
|
|
|
|
else if(event==28) { /* UV orco */
|
|
|
|
if(ELEM(base->object->type, OB_CURVE, OB_SURF)) {
|
|
|
|
cu= ob->data;
|
|
|
|
cu1= base->object->data;
|
2009-01-30 15:01:14 +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
|
|
|
if(cu->flag & CU_UV_ORCO)
|
|
|
|
cu1->flag |= CU_UV_ORCO;
|
|
|
|
else
|
|
|
|
cu1->flag &= ~CU_UV_ORCO;
|
|
|
|
}
|
2009-01-17 18:35:33 +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
|
|
|
else if(event==29) { /* protected bits */
|
|
|
|
base->object->protectflag= ob->protectflag;
|
2009-01-17 18:35:33 +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
|
|
|
else if(event==30) { /* index object */
|
|
|
|
base->object->index= ob->index;
|
|
|
|
}
|
|
|
|
else if(event==31) { /* object color */
|
|
|
|
QUATCOPY(base->object->col, ob->col);
|
2008-12-23 19:47:33 +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
|
|
|
|
|
|
|
if(do_scene_sort)
|
|
|
|
DAG_scene_sort(scene);
|
2009-01-30 15:01:14 +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
|
|
|
ED_anim_dag_flush_update(C);
|
2009-01-30 15:01:14 +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
|
|
|
void copy_attr_menu(Scene *scene, View3D *v3d)
|
2009-01-30 15:01:14 +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
|
|
|
Object *ob;
|
|
|
|
short event;
|
|
|
|
char str[512];
|
2009-01-30 15:01:14 +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
|
|
|
if(!(ob=OBACT)) return;
|
2009-01-30 15:01:14 +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
|
|
|
if (scene->obedit) { // XXX get from context
|
|
|
|
// if (ob->type == OB_MESH)
|
|
|
|
// XXX mesh_copy_menu();
|
|
|
|
return;
|
2009-01-30 15:01:14 +00:00
|
|
|
}
|
2009-01-17 18:35:33 +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
|
|
|
/* Object Mode */
|
2009-01-17 18:35:33 +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
|
|
|
/* If you change this menu, don't forget to update the menu in header_view3d.c
|
|
|
|
* view3d_edit_object_copyattrmenu() and in toolbox.c
|
|
|
|
*/
|
2009-01-17 18:35:33 +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
|
|
|
strcpy(str, "Copy Attributes %t|Location%x1|Rotation%x2|Size%x3|Draw Options%x4|Time Offset%x5|Dupli%x6|Object Color%x31|%l|Mass%x7|Damping%x8|All Physical Attributes%x11|Properties%x9|Logic Bricks%x10|Protected Transform%x29|%l");
|
2009-01-17 18:35:33 +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
|
|
|
strcat (str, "|Object Constraints%x22");
|
|
|
|
strcat (str, "|NLA Strips%x26");
|
2009-01-17 18:35:33 +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
|
|
|
// XXX if (OB_SUPPORT_MATERIAL(ob)) {
|
|
|
|
// strcat(str, "|Texture Space%x17");
|
|
|
|
// }
|
2009-01-31 19:40:40 +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
|
|
|
if(ob->type == OB_FONT) strcat(str, "|Font Settings%x18|Bevel Settings%x19");
|
|
|
|
if(ob->type == OB_CURVE) strcat(str, "|Bevel Settings%x19|UV Orco%x28");
|
|
|
|
|
|
|
|
if((ob->type == OB_FONT) || (ob->type == OB_CURVE)) {
|
|
|
|
strcat(str, "|Curve Resolution%x25");
|
2009-07-13 00:40:20 +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
|
|
|
if(ob->type==OB_MESH){
|
|
|
|
strcat(str, "|Subsurf Settings%x21|AutoSmooth%x27");
|
|
|
|
}
|
2009-07-13 00:40:20 +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
|
|
|
if(ob->soft) strcat(str, "|Soft Body Settings%x23");
|
2009-07-13 00:40:20 +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
|
|
|
strcat(str, "|Pass Index%x30");
|
2009-07-13 00:40:20 +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
|
|
|
if(ob->type==OB_MESH || ob->type==OB_CURVE || ob->type==OB_LATTICE || ob->type==OB_SURF){
|
|
|
|
strcat(str, "|Modifiers ...%x24");
|
|
|
|
}
|
|
|
|
|
|
|
|
event= pupmenu(str);
|
|
|
|
if(event<= 0) return;
|
|
|
|
|
|
|
|
copy_attr(scene, v3d, event);
|
2009-07-13 00:40:20 +00:00
|
|
|
}
|
|
|
|
|
2009-07-21 00:36:07 +00:00
|
|
|
/********************** Smooth/Flat *********************/
|
|
|
|
|
|
|
|
static int shade_smooth_exec(bContext *C, wmOperator *op)
|
|
|
|
{
|
|
|
|
Object *ob;
|
|
|
|
Curve *cu;
|
|
|
|
Nurb *nu;
|
|
|
|
int clear= (strcmp(op->idname, "OBJECT_OT_shade_flat") == 0);
|
|
|
|
int done= 0;
|
|
|
|
|
|
|
|
CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
|
|
|
|
ob= base->object;
|
|
|
|
|
|
|
|
if(ob->type==OB_MESH) {
|
|
|
|
mesh_set_smooth_flag(ob, !clear);
|
|
|
|
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
|
2009-07-21 00:36:07 +00:00
|
|
|
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
|
|
|
|
|
|
|
|
done= 1;
|
|
|
|
}
|
|
|
|
else if ELEM(ob->type, OB_SURF, OB_CURVE) {
|
|
|
|
cu= ob->data;
|
|
|
|
|
|
|
|
for(nu=cu->nurb.first; nu; nu=nu->next) {
|
|
|
|
if(!clear) nu->flag |= ME_SMOOTH;
|
|
|
|
else nu->flag &= ~ME_SMOOTH;
|
|
|
|
}
|
|
|
|
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
|
2009-07-21 00:36:07 +00:00
|
|
|
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
|
|
|
|
|
|
|
|
done= 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
CTX_DATA_END;
|
|
|
|
|
|
|
|
return (done)? OPERATOR_FINISHED: OPERATOR_CANCELLED;
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBJECT_OT_shade_flat(wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
/* identifiers */
|
|
|
|
ot->name= "Shade Flat";
|
|
|
|
ot->idname= "OBJECT_OT_shade_flat";
|
|
|
|
|
|
|
|
/* api callbacks */
|
|
|
|
ot->exec= shade_smooth_exec;
|
|
|
|
|
|
|
|
/* flags */
|
|
|
|
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBJECT_OT_shade_smooth(wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
/* identifiers */
|
|
|
|
ot->name= "Shade Smooth";
|
|
|
|
ot->idname= "OBJECT_OT_shade_smooth";
|
|
|
|
|
|
|
|
/* api callbacks */
|
|
|
|
ot->exec= shade_smooth_exec;
|
|
|
|
|
|
|
|
/* flags */
|
|
|
|
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-01-17 18:35:33 +00:00
|
|
|
/* ********************** */
|
|
|
|
|
2008-12-23 19:47:33 +00:00
|
|
|
void image_aspect(Scene *scene, View3D *v3d)
|
|
|
|
{
|
|
|
|
/* all selected objects with an image map: scale in image aspect */
|
|
|
|
Base *base;
|
|
|
|
Object *ob;
|
|
|
|
Material *ma;
|
|
|
|
Tex *tex;
|
|
|
|
float x, y, space;
|
|
|
|
int a, b, done;
|
|
|
|
|
2009-01-02 19:10:35 +00:00
|
|
|
if(scene->obedit) return; // XXX get from context
|
2008-12-23 19:47:33 +00:00
|
|
|
if(scene->id.lib) return;
|
|
|
|
|
|
|
|
for(base= FIRSTBASE; base; base= base->next) {
|
|
|
|
if(TESTBASELIB(v3d, base)) {
|
|
|
|
ob= base->object;
|
|
|
|
done= 0;
|
|
|
|
|
|
|
|
for(a=1; a<=ob->totcol; a++) {
|
|
|
|
ma= give_current_material(ob, a);
|
|
|
|
if(ma) {
|
|
|
|
for(b=0; b<MAX_MTEX; b++) {
|
|
|
|
if(ma->mtex[b] && ma->mtex[b]->tex) {
|
|
|
|
tex= ma->mtex[b]->tex;
|
|
|
|
if(tex->type==TEX_IMAGE && tex->ima) {
|
|
|
|
ImBuf *ibuf= BKE_image_get_ibuf(tex->ima, NULL);
|
|
|
|
|
|
|
|
/* texturespace */
|
|
|
|
space= 1.0;
|
|
|
|
if(ob->type==OB_MESH) {
|
|
|
|
float size[3];
|
|
|
|
mesh_get_texspace(ob->data, NULL, NULL, size);
|
|
|
|
space= size[0]/size[1];
|
|
|
|
}
|
|
|
|
else if(ELEM3(ob->type, OB_CURVE, OB_FONT, OB_SURF)) {
|
|
|
|
Curve *cu= ob->data;
|
|
|
|
space= cu->size[0]/cu->size[1];
|
|
|
|
}
|
|
|
|
|
|
|
|
x= ibuf->x/space;
|
|
|
|
y= ibuf->y;
|
|
|
|
|
|
|
|
if(x>y) ob->size[0]= ob->size[1]*x/y;
|
|
|
|
else ob->size[1]= ob->size[0]*y/x;
|
|
|
|
|
|
|
|
done= 1;
|
2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
should only be used for notifying about changes in space data,
we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
2009-09-04 20:51:09 +00:00
|
|
|
DAG_id_flush_update(&ob->id, OB_RECALC_OB);
|
2008-12-23 19:47:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if(done) break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(done) break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void set_ob_ipoflags(Scene *scene, View3D *v3d)
|
|
|
|
{
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
#if 0 // XXX old animation system
|
2008-12-23 19:47:33 +00:00
|
|
|
Base *base;
|
|
|
|
int set= 1;
|
|
|
|
|
|
|
|
if (!v3d) {
|
|
|
|
error("Can't do this! Open a 3D window");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
for(base= FIRSTBASE; base; base= base->next) {
|
|
|
|
if(TESTBASELIB(v3d, base)) {
|
|
|
|
if(base->object->ipoflag & OB_DRAWKEY) {
|
|
|
|
set= 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for(base= FIRSTBASE; base; base= base->next) {
|
|
|
|
if(TESTBASELIB(v3d, base)) {
|
|
|
|
if(set) {
|
|
|
|
base->object->ipoflag |= OB_DRAWKEY;
|
|
|
|
if(base->object->ipo) base->object->ipo->showkey= 1;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
base->object->ipoflag &= ~OB_DRAWKEY;
|
|
|
|
if(base->object->ipo) base->object->ipo->showkey= 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
#endif // XXX old animation system
|
2008-12-23 19:47:33 +00:00
|
|
|
}
|
|
|
|
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
|
2008-12-23 19:47:33 +00:00
|
|
|
void select_select_keys(Scene *scene, View3D *v3d)
|
|
|
|
{
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
#if 0 // XXX old animation system
|
2008-12-23 19:47:33 +00:00
|
|
|
Base *base;
|
|
|
|
IpoCurve *icu;
|
|
|
|
BezTriple *bezt;
|
|
|
|
int a;
|
|
|
|
|
|
|
|
if (!v3d) {
|
|
|
|
error("Can't do this! Open a 3D window");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(scene->id.lib) return;
|
|
|
|
|
|
|
|
if(okee("Show and select all keys")==0) return;
|
|
|
|
|
|
|
|
for(base= FIRSTBASE; base; base= base->next) {
|
|
|
|
if(TESTBASELIB(v3d, base)) {
|
|
|
|
if(base->object->ipo) {
|
|
|
|
base->object->ipoflag |= OB_DRAWKEY;
|
|
|
|
base->object->ipo->showkey= 1;
|
|
|
|
icu= base->object->ipo->curve.first;
|
|
|
|
while(icu) {
|
|
|
|
a= icu->totvert;
|
|
|
|
bezt= icu->bezt;
|
|
|
|
while(a--) {
|
|
|
|
bezt->f1 |= SELECT;
|
|
|
|
bezt->f2 |= SELECT;
|
|
|
|
bezt->f3 |= SELECT;
|
|
|
|
bezt++;
|
|
|
|
}
|
|
|
|
icu= icu->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
#endif // XXX old animation system
|
2008-12-23 19:47:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int vergbaseco(const void *a1, const void *a2)
|
|
|
|
{
|
|
|
|
Base **x1, **x2;
|
|
|
|
|
|
|
|
x1= (Base **) a1;
|
|
|
|
x2= (Base **) a2;
|
|
|
|
|
|
|
|
if( (*x1)->sy > (*x2)->sy ) return 1;
|
|
|
|
else if( (*x1)->sy < (*x2)->sy) return -1;
|
|
|
|
else if( (*x1)->sx > (*x2)->sx ) return 1;
|
|
|
|
else if( (*x1)->sx < (*x2)->sx ) return -1;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void auto_timeoffs(Scene *scene, View3D *v3d)
|
|
|
|
{
|
|
|
|
Base *base, **basesort, **bs;
|
|
|
|
float start, delta;
|
|
|
|
int tot=0, a;
|
|
|
|
short offset=25;
|
|
|
|
|
|
|
|
if(BASACT==0 || v3d==NULL) return;
|
|
|
|
// XXX if(button(&offset, 0, 1000,"Total time")==0) return;
|
|
|
|
|
|
|
|
/* make array of all bases, xco yco (screen) */
|
|
|
|
for(base= FIRSTBASE; base; base= base->next) {
|
|
|
|
if(TESTBASELIB(v3d, base)) {
|
|
|
|
tot++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
delta= (float)offset/(float)tot;
|
|
|
|
start= OBACT->sf;
|
|
|
|
|
|
|
|
bs= basesort= MEM_mallocN(sizeof(void *)*tot,"autotimeoffs");
|
|
|
|
for(base= FIRSTBASE; base; base= base->next) {
|
|
|
|
if(TESTBASELIB(v3d, base)) {
|
|
|
|
*bs= base;
|
|
|
|
bs++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
qsort(basesort, tot, sizeof(void *), vergbaseco);
|
|
|
|
|
|
|
|
bs= basesort;
|
|
|
|
for(a=0; a<tot; a++) {
|
|
|
|
|
|
|
|
(*bs)->object->sf= start;
|
|
|
|
start+= delta;
|
|
|
|
|
|
|
|
bs++;
|
|
|
|
}
|
|
|
|
MEM_freeN(basesort);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void ofs_timeoffs(Scene *scene, View3D *v3d)
|
|
|
|
{
|
|
|
|
Base *base;
|
|
|
|
float offset=0.0f;
|
|
|
|
|
|
|
|
if(BASACT==0 || v3d==NULL) return;
|
|
|
|
|
|
|
|
// XXX if(fbutton(&offset, -10000.0f, 10000.0f, 10, 10, "Offset")==0) return;
|
|
|
|
|
|
|
|
/* make array of all bases, xco yco (screen) */
|
|
|
|
for(base= FIRSTBASE; base; base= base->next) {
|
|
|
|
if(TESTBASELIB(v3d, base)) {
|
|
|
|
base->object->sf += offset;
|
|
|
|
if (base->object->sf < -MAXFRAMEF) base->object->sf = -MAXFRAMEF;
|
|
|
|
else if (base->object->sf > MAXFRAMEF) base->object->sf = MAXFRAMEF;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void rand_timeoffs(Scene *scene, View3D *v3d)
|
|
|
|
{
|
|
|
|
Base *base;
|
|
|
|
float rand=0.0f;
|
|
|
|
|
|
|
|
if(BASACT==0 || v3d==NULL) return;
|
|
|
|
|
|
|
|
// XXX if(fbutton(&rand, 0.0f, 10000.0f, 10, 10, "Randomize")==0) return;
|
|
|
|
|
|
|
|
rand *= 2;
|
|
|
|
|
|
|
|
for(base= FIRSTBASE; base; base= base->next) {
|
|
|
|
if(TESTBASELIB(v3d, base)) {
|
|
|
|
base->object->sf += (BLI_drand()-0.5) * rand;
|
|
|
|
if (base->object->sf < -MAXFRAMEF) base->object->sf = -MAXFRAMEF;
|
|
|
|
else if (base->object->sf > MAXFRAMEF) base->object->sf = MAXFRAMEF;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2009-08-16 05:48:07 +00:00
|
|
|
static EnumPropertyItem *object_mode_set_itemsf(bContext *C, PointerRNA *ptr, int *free)
|
|
|
|
{
|
|
|
|
EnumPropertyItem *input = object_mode_items;
|
|
|
|
EnumPropertyItem *item= NULL;
|
2009-08-16 16:35:14 +00:00
|
|
|
Object *ob;
|
2009-08-16 05:48:07 +00:00
|
|
|
int totitem= 0;
|
|
|
|
|
|
|
|
if(!C) /* needed for docs */
|
|
|
|
return object_mode_items;
|
|
|
|
|
2009-08-16 16:35:14 +00:00
|
|
|
ob = CTX_data_active_object(C);
|
2009-08-16 05:48:07 +00:00
|
|
|
while(ob && input->identifier) {
|
|
|
|
if((input->value == OB_MODE_EDIT && ((ob->type == OB_MESH) || (ob->type == OB_ARMATURE) ||
|
|
|
|
(ob->type == OB_CURVE) || (ob->type == OB_SURF) ||
|
|
|
|
(ob->type == OB_FONT) || (ob->type == OB_MBALL) || (ob->type == OB_LATTICE))) ||
|
|
|
|
(input->value == OB_MODE_POSE && (ob->type == OB_ARMATURE)) ||
|
|
|
|
(input->value == OB_MODE_PARTICLE_EDIT && ob->particlesystem.first) ||
|
|
|
|
((input->value == OB_MODE_SCULPT || input->value == OB_MODE_VERTEX_PAINT ||
|
|
|
|
input->value == OB_MODE_WEIGHT_PAINT || input->value == OB_MODE_TEXTURE_PAINT) && (ob->type == OB_MESH)) ||
|
|
|
|
(input->value == OB_MODE_OBJECT))
|
|
|
|
RNA_enum_item_add(&item, &totitem, input);
|
|
|
|
++input;
|
|
|
|
}
|
|
|
|
|
|
|
|
RNA_enum_item_end(&item, &totitem);
|
|
|
|
|
|
|
|
*free= 1;
|
|
|
|
|
|
|
|
return item;
|
|
|
|
}
|
|
|
|
|
2009-08-20 05:13:07 +00:00
|
|
|
static const char *object_mode_op_string(int mode)
|
|
|
|
{
|
2009-09-08 02:09:14 +00:00
|
|
|
if(mode & OB_MODE_EDIT)
|
2009-08-20 05:13:07 +00:00
|
|
|
return "OBJECT_OT_editmode_toggle";
|
|
|
|
if(mode == OB_MODE_SCULPT)
|
|
|
|
return "SCULPT_OT_sculptmode_toggle";
|
|
|
|
if(mode == OB_MODE_VERTEX_PAINT)
|
|
|
|
return "PAINT_OT_vertex_paint_toggle";
|
|
|
|
if(mode == OB_MODE_WEIGHT_PAINT)
|
|
|
|
return "PAINT_OT_weight_paint_toggle";
|
|
|
|
if(mode == OB_MODE_TEXTURE_PAINT)
|
|
|
|
return "PAINT_OT_texture_paint_toggle";
|
|
|
|
if(mode == OB_MODE_PARTICLE_EDIT)
|
|
|
|
return "PARTICLE_OT_particle_edit_toggle";
|
|
|
|
if(mode == OB_MODE_POSE)
|
|
|
|
return "OBJECT_OT_posemode_toggle";
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2009-09-08 07:35:07 +00:00
|
|
|
/* checks the mode to be set is compatible with the object
|
|
|
|
* should be made into a generic function */
|
|
|
|
static int object_mode_set_compat(bContext *C, wmOperator *op, Object *ob)
|
|
|
|
{
|
|
|
|
ObjectMode mode = RNA_enum_get(op->ptr, "mode");
|
|
|
|
|
|
|
|
if(ob) {
|
|
|
|
switch(ob->type) {
|
|
|
|
case OB_EMPTY:
|
|
|
|
case OB_LAMP:
|
|
|
|
case OB_CAMERA:
|
|
|
|
if(mode & OB_MODE_OBJECT)
|
|
|
|
return 1;
|
|
|
|
return 0;
|
|
|
|
case OB_MESH:
|
|
|
|
if(mode & ( OB_MODE_OBJECT|OB_MODE_EDIT|OB_MODE_SCULPT|OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT|OB_MODE_PARTICLE_EDIT))
|
|
|
|
return 1;
|
|
|
|
return 0;
|
|
|
|
case OB_CURVE:
|
|
|
|
case OB_SURF:
|
|
|
|
case OB_FONT:
|
|
|
|
case OB_MBALL:
|
|
|
|
if(mode & (OB_MODE_OBJECT|OB_MODE_EDIT))
|
|
|
|
return 1;
|
|
|
|
return 0;
|
|
|
|
case OB_LATTICE:
|
|
|
|
if(mode & (OB_MODE_OBJECT|OB_MODE_EDIT|OB_MODE_WEIGHT_PAINT))
|
|
|
|
return 1;
|
|
|
|
case OB_ARMATURE:
|
|
|
|
if(mode & (OB_MODE_OBJECT|OB_MODE_EDIT|OB_MODE_POSE))
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-08-16 05:48:07 +00:00
|
|
|
static int object_mode_set_exec(bContext *C, wmOperator *op)
|
|
|
|
{
|
|
|
|
Object *ob= CTX_data_active_object(C);
|
2009-08-21 17:35:35 +00:00
|
|
|
ObjectMode mode = RNA_enum_get(op->ptr, "mode");
|
|
|
|
ObjectMode restore_mode = ob->mode;
|
|
|
|
int toggle = RNA_boolean_get(op->ptr, "toggle");
|
2009-08-16 05:48:07 +00:00
|
|
|
|
2009-09-08 07:35:07 +00:00
|
|
|
if(!ob || !object_mode_set_compat(C, op, ob))
|
2009-09-12 18:52:26 +00:00
|
|
|
return OPERATOR_PASS_THROUGH;
|
2009-08-16 05:48:07 +00:00
|
|
|
|
2009-08-21 17:35:35 +00:00
|
|
|
/* Exit current mode if it's not the mode we're setting */
|
|
|
|
if(ob->mode != OB_MODE_OBJECT && ob->mode != mode)
|
2009-08-20 05:13:07 +00:00
|
|
|
WM_operator_name_call(C, object_mode_op_string(ob->mode), WM_OP_EXEC_REGION_WIN, NULL);
|
|
|
|
|
2009-08-21 17:35:35 +00:00
|
|
|
if(mode != OB_MODE_OBJECT) {
|
|
|
|
/* Enter new mode */
|
|
|
|
if(ob->mode != mode || toggle)
|
|
|
|
WM_operator_name_call(C, object_mode_op_string(mode), WM_OP_EXEC_REGION_WIN, NULL);
|
|
|
|
|
|
|
|
if(toggle) {
|
|
|
|
if(ob->mode == mode)
|
|
|
|
/* For toggling, store old mode so we know what to go back to */
|
|
|
|
ob->restore_mode = restore_mode;
|
|
|
|
else if(ob->restore_mode != OB_MODE_OBJECT && ob->restore_mode != mode) {
|
|
|
|
WM_operator_name_call(C, object_mode_op_string(ob->restore_mode), WM_OP_EXEC_REGION_WIN, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-08-16 05:48:07 +00:00
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBJECT_OT_mode_set(wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
/* identifiers */
|
|
|
|
ot->name= "Set Object Mode";
|
|
|
|
ot->description = "Sets the object interaction mode.";
|
|
|
|
ot->idname= "OBJECT_OT_mode_set";
|
|
|
|
|
|
|
|
/* api callbacks */
|
|
|
|
ot->exec= object_mode_set_exec;
|
|
|
|
|
|
|
|
ot->poll= ED_operator_object_active;
|
|
|
|
|
|
|
|
/* flags */
|
|
|
|
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
|
|
|
|
|
|
|
prop= RNA_def_enum(ot->srna, "mode", object_mode_items, 0, "Mode", "");
|
|
|
|
RNA_def_enum_funcs(prop, object_mode_set_itemsf);
|
2009-08-21 17:35:35 +00:00
|
|
|
|
|
|
|
RNA_def_boolean(ot->srna, "toggle", 0, "Toggle", "");
|
2009-08-16 05:48:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-08-15 18:58:01 +00:00
|
|
|
void ED_object_toggle_modes(bContext *C, int mode)
|
|
|
|
{
|
|
|
|
if(mode & OB_MODE_SCULPT)
|
|
|
|
WM_operator_name_call(C, "SCULPT_OT_sculptmode_toggle", WM_OP_EXEC_REGION_WIN, NULL);
|
2009-08-15 20:36:15 +00:00
|
|
|
if(mode & OB_MODE_VERTEX_PAINT)
|
2009-08-15 21:46:25 +00:00
|
|
|
WM_operator_name_call(C, "PAINT_OT_vertex_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL);
|
|
|
|
if(mode & OB_MODE_WEIGHT_PAINT)
|
|
|
|
WM_operator_name_call(C, "PAINT_OT_weight_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL);
|
2009-08-16 01:25:53 +00:00
|
|
|
if(mode & OB_MODE_TEXTURE_PAINT)
|
|
|
|
WM_operator_name_call(C, "PAINT_OT_texture_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL);
|
2009-08-16 02:35:44 +00:00
|
|
|
if(mode & OB_MODE_PARTICLE_EDIT)
|
|
|
|
WM_operator_name_call(C, "PARTICLE_OT_particle_edit_toggle", WM_OP_EXEC_REGION_WIN, NULL);
|
2009-09-08 02:09:14 +00:00
|
|
|
if(mode & OB_MODE_POSE)
|
|
|
|
WM_operator_name_call(C, "OBJECT_OT_posemode_toggle", WM_OP_EXEC_REGION_WIN, NULL);
|
2009-08-15 18:58:01 +00:00
|
|
|
}
|
2009-08-26 12:51:27 +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
|
|
|
/************************ Game Properties ***********************/
|
2009-08-26 12:51:27 +00:00
|
|
|
|
|
|
|
static int game_property_new(bContext *C, wmOperator *op)
|
|
|
|
{
|
|
|
|
Object *ob= CTX_data_active_object(C);
|
|
|
|
bProperty *prop;
|
|
|
|
|
|
|
|
if(!ob)
|
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
|
|
|
|
prop= new_property(PROP_FLOAT);
|
|
|
|
BLI_addtail(&ob->prop, prop);
|
|
|
|
unique_property(NULL, prop, 0); // make_unique_prop_names(prop->name);
|
|
|
|
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void OBJECT_OT_game_property_new(wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
/* identifiers */
|
|
|
|
ot->name= "New Game Property";
|
|
|
|
ot->idname= "OBJECT_OT_game_property_new";
|
|
|
|
|
|
|
|
/* api callbacks */
|
|
|
|
ot->exec= game_property_new;
|
|
|
|
|
|
|
|
/* flags */
|
|
|
|
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int game_property_remove(bContext *C, wmOperator *op)
|
|
|
|
{
|
|
|
|
Object *ob= CTX_data_active_object(C);
|
|
|
|
bProperty *prop;
|
|
|
|
int index;
|
|
|
|
|
|
|
|
if(!ob)
|
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
|
|
|
|
index = RNA_int_get(op->ptr, "index");
|
|
|
|
|
|
|
|
prop= BLI_findlink(&ob->prop, index);
|
|
|
|
|
|
|
|
if(prop) {
|
|
|
|
BLI_remlink(&ob->prop, prop);
|
|
|
|
free_property(prop);
|
|
|
|
return OPERATOR_FINISHED;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return OPERATOR_CANCELLED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBJECT_OT_game_property_remove(wmOperatorType *ot)
|
|
|
|
{
|
|
|
|
/* identifiers */
|
|
|
|
ot->name= "Remove Game Property";
|
|
|
|
ot->idname= "OBJECT_OT_game_property_remove";
|
|
|
|
|
|
|
|
/* api callbacks */
|
|
|
|
ot->exec= game_property_remove;
|
|
|
|
|
|
|
|
/* flags */
|
|
|
|
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
|
|
|
|
|
|
|
|
RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "Property index to remove ", 0, INT_MAX);
|
|
|
|
}
|
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
|
|
|
|