[Bf-committers] Convert Menu Patch

Ton Roosendaal ton at blender.org
Thu Mar 3 13:49:15 CET 2005


Hi,

Added to my todo... have quite some patches to check still. Soon!

-Ton-

On 1 Mar, 2005, at 18:26, Johnny Matthews wrote:

> Here is a patch that adds an option to converting Subsurfs and Metas.  
> Instead of just Convert to "Mesh (Keep Original)" it adds "Mesh  
> (Delete Original)" to the pupmenu. Can someone who knows better check  
> my code to see if I am deleteing the objects in the proper manner. It  
> did not crash my system and seemed to work correctly, but I have been  
> known to break stuff before :)
>
> Please give me some feedback and thoughts on this feature in general.  
> It is handy when you have a large amount of meshs that you are going  
> to join and some are subsurf and some not, then you can select them  
> all, convert the subsurf ones to mesh (deleting orig) and then join.
>
> Also, Ton, who would this fall under, You I would guess.
>
> Johnny Matthews
> guitarGeek
>
>
>
> Index: source/blender/src/editobject.c
> ===================================================================
> RCS file: /cvsroot/bf-blender/blender/source/blender/src/editobject.c,v
> retrieving revision 1.163
> diff -u -r1.163 editobject.c
> --- source/blender/src/editobject.c	25 Feb 2005 17:40:03 -0000	1.163
> +++ source/blender/src/editobject.c	1 Mar 2005 17:09:23 -0000
> @@ -2081,7 +2081,7 @@
>
>  void convertmenu(void)
>  {
> -	Base *base, *basen, *basact;
> +	Base *base, *basen, *basact, *basedel=NULL;
>  	Object *ob, *ob1;
>  	Curve *cu;
>  	MetaBall *mb;
> @@ -2102,7 +2102,7 @@
>  		if(nr>0) ok= 1;
>  	}
>  	else if(ob->type==OB_MBALL) {
> -		nr= pupmenu("Convert Metaball to%t|Mesh (keep original)");
> +		nr= pupmenu("Convert Metaball to%t|Mesh (keep original)%x1|Mesh  
> (Delete Original)%x2");
>  		if(nr>0) ok= 1;
>  	}
>  	else if(ob->type==OB_CURVE) {
> @@ -2114,7 +2114,7 @@
>  		if(nr>0) ok= 1;
>  	}
>  	else if(ob->type==OB_MESH && mesh_uses_displist((Mesh*) ob->data)) {
> -		nr= pupmenu("Convert SubSurf to%t|Mesh (Keep Original)");
> +		nr= pupmenu("Convert SubSurf to%t|Mesh (Keep Original)%x1|Mesh  
> (Delete Original)%x2");
>  		if(nr>0) ok= 1;
>  	}
>  	if(ok==0) return;
> @@ -2143,6 +2143,8 @@
>  				if (mesh_uses_displist(oldme)) {
>  					DispListMesh *dlm;
>
> +					basedel = base;
> +
>  					ob->flag |= OB_DONE;
>
>  					ob1= copy_object(ob);
> @@ -2176,6 +2178,7 @@
>  					enter_editmode();
>  					exit_editmode(1); // freedata, but no undo
>  					BASACT= basact;
> +					
>  				}
>  			}
>  			else if(ob->type==OB_FONT) {
> @@ -2220,10 +2223,11 @@
>  			}
>  			else if(ob->type==OB_MBALL) {
>  			
> -				if(nr==1) {
> +				if(nr==1 || nr == 2) {
>  					ob= find_basis_mball(ob);
>  					
>  					if(ob->disp.first && !(ob->flag&OB_DONE)) {
> +						basedel = base;
>  					
>  						ob->flag |= OB_DONE;
>
> @@ -2256,8 +2260,11 @@
>  			}
>  		}
>  		base= base->next;
> +		if(basedel != NULL && nr == 2)
> +			free_and_unlink_base(basedel);	
> +		basedel = NULL;				
>  	}
> -	
> +	countall();
>  	allqueue(REDRAWVIEW3D, 0);
>  	allqueue(REDRAWOOPS, 0);
>  	allqueue(REDRAWBUTSEDIT, 0);
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at projects.blender.org
> http://projects.blender.org/mailman/listinfo/bf-committers
>
------------------------------------------------------------------------ 
--
Ton Roosendaal  Blender Foundation ton at blender.org  
http://www.blender.org



More information about the Bf-committers mailing list