[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43217] trunk/blender/source/blender: Code cleanup

Joshua Leung aligorith at gmail.com
Sun Jan 8 05:14:21 CET 2012


Revision: 43217
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43217
Author:   aligorith
Date:     2012-01-08 04:14:13 +0000 (Sun, 08 Jan 2012)
Log Message:
-----------
Code cleanup

Removing some old + unused stuff that's not coming back. For example, the code
for the old "specials menu" used everywhere/all contexts.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/scene.c
    trunk/blender/source/blender/editors/object/object_edit.c

Modified: trunk/blender/source/blender/blenkernel/intern/scene.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/scene.c	2012-01-08 02:21:30 UTC (rev 43216)
+++ trunk/blender/source/blender/blenkernel/intern/scene.c	2012-01-08 04:14:13 UTC (rev 43217)
@@ -78,8 +78,6 @@
 //XXX #include "BIF_previewrender.h"
 //XXX #include "BIF_editseq.h"
 
-//XXX #include "nla.h"
-
 #ifdef WIN32
 #else
 #include <sys/time.h>

Modified: trunk/blender/source/blender/editors/object/object_edit.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_edit.c	2012-01-08 02:21:30 UTC (rev 43216)
+++ trunk/blender/source/blender/editors/object/object_edit.c	2012-01-08 04:14:13 UTC (rev 43217)
@@ -108,7 +108,6 @@
 static int pupmenu(const char *UNUSED(msg)) {return 0;}
 
 /* port over here */
-static bContext *evil_C;
 static void error_libdata(void) {}
 
 Object *ED_object_context(bContext *C)
@@ -722,240 +721,6 @@
 }
 #endif
 
-static void UNUSED_FUNCTION(special_editmenu)(Scene *scene, View3D *v3d)
-{
-// XXX	static short numcuts= 2;
-	Object *ob= OBACT;
-	Object *obedit= NULL; // XXX
-	int nr,ret=0;
-	
-	if(ob==NULL) return;
-	
-	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==NULL || me->mtface==NULL) 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= NULL;
-						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;
-					}
-				}
-			}
-			DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
-		}
-		else if(ob->mode & OB_MODE_VERTEX_PAINT) {
-			Mesh *me= get_mesh(ob);
-			
-			if(me==NULL || (me->mcol==NULL && me->mtface==NULL) ) return;
-			
-			nr= pupmenu("Specials%t|Shared VertexCol%x1");
-			if(nr==1) {
-				
-// XXX				do_shared_vertexcol(me);
-				
-				DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
-			}
-		}
-		else if(ob->mode & OB_MODE_WEIGHT_PAINT) {
-			Object *par= modifiers_isDeformedByArmature(ob);
-
-			if(par && (par->mode & OB_MODE_POSE)) {
-// XXX				nr= pupmenu("Specials%t|Apply Bone Envelopes to Vertex Groups %x1|Apply Bone Heat Weights to Vertex Groups %x2");
-
-// XXX				if(nr==1 || nr==2)
-// XXX					pose_adds_vgroups(ob, (nr == 2));
-			}
-		}
-		else if(ob->mode & OB_MODE_PARTICLE_EDIT) {
-#if 0
-			// XXX
-			ParticleSystem *psys = PE_get_current(ob);
-			ParticleEditSettings *pset = PE_settings();
-
-			if(!psys)
-				return;
-
-			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");
-			
-			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;
-			}
-			
-			DAG_id_tag_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) {
-				
-				/* 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;
-						}
-					}
-
-					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);
-								modifier_unique_name(&ob->modifiers, (ModifierData*)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");
-						}
-					} else {
-						error("Please select 2 meshes");
-					}
-				}
-
-			}
-			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();
-					}
-				}
-*/
-			}			
-		}
-	}
-	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")) {
-			Lattice *editlt= lt->editlatt->latt;
-			int a= editlt->pntsu*editlt->pntsv*editlt->pntsw;
-			BPoint *bp= editlt->def;
-			
-			while(a--) {
-				if(bp->f1 & SELECT)
-					bp->weight= weight;
-				bp++;
-			}
-		}
-	}
-
-}
-
 static void copymenu_properties(Scene *scene, View3D *v3d, Object *ob)
 {	
 //XXX no longer used - to be removed - replaced by game_properties_copy_exec
@@ -1678,103 +1443,7 @@
 	
 }
 
-static 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;
-}
-
-
-static void UNUSED_FUNCTION(auto_timeoffs)(Scene *scene, View3D *v3d)
-{
-	Base *base, **basesort, **bs;
-	float start, delta;
-	int tot=0, a;
-	short offset=25;
-
-	if(BASACT==NULL || 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);
-
-}
-
-static void UNUSED_FUNCTION(ofs_timeoffs)(Scene *scene, View3D *v3d)
-{
-	float offset=0.0f;
-
-	if(BASACT==NULL || v3d==NULL) return;
-	
-// XXX	if(fbutton(&offset, -10000.0f, 10000.0f, 10, 10, "Offset")==0) return;
-
-	/* make array of all bases, xco yco (screen) */
-	CTX_DATA_BEGIN(evil_C, Object*, ob, selected_editable_objects) {
-		ob->sf += offset;
-		if (ob->sf < -MAXFRAMEF)		ob->sf = -MAXFRAMEF;
-		else if (ob->sf > MAXFRAMEF)	ob->sf = MAXFRAMEF;
-	}
-	CTX_DATA_END;
-
-}
-
-
-static void UNUSED_FUNCTION(rand_timeoffs)(Scene *scene, View3D *v3d)
-{
-	Base *base;
-	float rand_ofs=0.0f;
-
-	if(BASACT==NULL || v3d==NULL) return;
-	
-// XXX	if(fbutton(&rand_ofs, 0.0f, 10000.0f, 10, 10, "Randomize")==0) return;
-	
-	rand_ofs *= 2;
-	
-	for(base= FIRSTBASE; base; base= base->next) {
-		if(TESTBASELIB(v3d, base)) {
-			base->object->sf += ((float)BLI_drand()-0.5f) * rand_ofs;
-			if (base->object->sf < -MAXFRAMEF)		base->object->sf = -MAXFRAMEF;
-			else if (base->object->sf > MAXFRAMEF)	base->object->sf = MAXFRAMEF;
-		}
-	}
-
-}
-
 static EnumPropertyItem *object_mode_set_itemsf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
 {	
 	EnumPropertyItem *input = object_mode_items;



More information about the Bf-blender-cvs mailing list