svn merge -r 15973:16060 https://svn.blender.org/svnroot/bf-blender/trunk/blender
authorDaniel Genrich <daniel.genrich@gmx.net>
Tue, 12 Aug 2008 09:49:46 +0000 (09:49 +0000)
committerDaniel Genrich <daniel.genrich@gmx.net>
Tue, 12 Aug 2008 09:49:46 +0000 (09:49 +0000)
1  2 
config/linux2-config.py
source/blender/blenkernel/intern/modifier.c
source/blender/blenkernel/intern/particle_system.c
source/blender/src/buttons_editing.c

diff --combined config/linux2-config.py
index 46611b80f3bb28dbbd9277030805a2fd921c5c30,fe4325361a83b4874abda7fedc749fae31fbdb1e..332af28977f88a5e13924e445b0e0398fd4e2ca8
@@@ -139,7 -139,7 +139,7 @@@ BF_OPENJPEG_LIB = '
  BF_OPENJPEG_INC = '${BF_OPENJPEG}/include'
  BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
  
- WITH_BF_REDCODE = 'true'  
+ WITH_BF_REDCODE = 'false'  
  BF_REDCODE = '#extern/libredcode'
  BF_REDCODE_LIB = ''
  # Uncomment the following two lines to use system's ffmpeg
@@@ -166,8 -166,8 +166,8 @@@ CCFLAGS = ['-pipe','-fPIC','-funsigned-
  
  CPPFLAGS = ['-DXP_UNIX']
  CXXFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing']
 -REL_CFLAGS = ['-O2']
 -REL_CCFLAGS = ['-O2']
 +REL_CFLAGS = ['-O3']
 +REL_CCFLAGS = ['-O3']
  ##BF_DEPEND = 'true'
  ##
  ##AR = ar
index 88a3c64cbf278dc98b97b6b72f817438efcea86c,1dc76296c28783d75d5164f5ca7280fc7fd6c0f6..8bc82a6731c490162976da606122b9877aa2984a
@@@ -55,9 -55,7 +55,9 @@@
  #include "MEM_guardedalloc.h"
  
  #include "DNA_armature_types.h"
 +#include "DNA_camera_types.h"
  #include "DNA_cloth_types.h"
 +#include "DNA_curve_types.h"
  #include "DNA_effect_types.h"
  #include "DNA_material_types.h"
  #include "DNA_mesh_types.h"
@@@ -68,6 -66,8 +68,6 @@@
  #include "DNA_particle_types.h"
  #include "DNA_scene_types.h"
  #include "DNA_texture_types.h"
 -#include "DNA_curve_types.h"
 -#include "DNA_camera_types.h"
  
  #include "BLI_editVert.h"
  
  #include "BKE_main.h"
  #include "BKE_anim.h"
  #include "BKE_bad_level_calls.h"
 +#include "BKE_bmesh.h"
 +#include "BKE_booleanops.h"
  #include "BKE_cloth.h"
  #include "BKE_collision.h"
 +#include "BKE_cdderivedmesh.h"
  #include "BKE_curve.h"
  #include "BKE_customdata.h"
 -#include "BKE_global.h"
 -#include "BKE_cdderivedmesh.h"
  #include "BKE_DerivedMesh.h"
 -#include "BKE_booleanops.h"
  #include "BKE_displist.h"
 -#include "BKE_modifier.h"
 +#include "BKE_fluidsim.h"
 +#include "BKE_global.h"
  #include "BKE_lattice.h"
  #include "BKE_library.h"
 -#include "BKE_subsurf.h"
 -#include "BKE_object.h"
 -#include "BKE_mesh.h"
 -#include "BKE_softbody.h"
 -#include "BKE_cloth.h"
  #include "BKE_material.h"
 +#include "BKE_mesh.h"
 +#include "BKE_modifier.h"
 +#include "BKE_object.h"
  #include "BKE_particle.h"
  #include "BKE_pointcache.h"
 +#include "BKE_softbody.h"
 +#include "BKE_subsurf.h"
+ #include "BKE_texture.h"
  #include "BKE_utildefines.h"
 +
  #include "depsgraph_private.h"
 -#include "BKE_bmesh.h"
  
  #include "LOD_DependKludge.h"
  #include "LOD_decimation.h"
@@@ -6924,93 -6924,6 +6925,93 @@@ static DerivedMesh * explodeModifier_ap
        }
        return derivedData;
  }
 +
 +/* Fluidsim */
 +static void fluidsimModifier_initData(ModifierData *md)
 +{
 +      FluidsimModifierData *fluidmd= (FluidsimModifierData*) md;
 +      
 +      fluidsim_init(fluidmd);
 +}
 +static void fluidsimModifier_freeData(ModifierData *md)
 +{
 +      FluidsimModifierData *fluidmd= (FluidsimModifierData*) md;
 +      
 +      fluidsim_free(fluidmd);
 +}
 +
 +static void fluidsimModifier_copyData(ModifierData *md, ModifierData *target)
 +{
 +      FluidsimModifierData *fluidmd= (FluidsimModifierData*) md;
 +      FluidsimModifierData *tfluidmd= (FluidsimModifierData*) target;
 +      
 +      if(tfluidmd->fss)
 +              MEM_freeN(tfluidmd->fss);
 +      
 +      tfluidmd->fss = MEM_dupallocN(fluidmd->fss);
 +}
 +
 +static DerivedMesh * fluidsimModifier_applyModifier(
 +              ModifierData *md, Object *ob, DerivedMesh *derivedData,
 +  int useRenderParams, int isFinalCalc)
 +{
 +      FluidsimModifierData *fluidmd= (FluidsimModifierData*) md;
 +      DerivedMesh *result = NULL;
 +      
 +      /* check for alloc failing */
 +      if(!fluidmd->fss)
 +      {
 +              fluidsimModifier_initData(md);
 +              
 +              if(!fluidmd->fss)
 +                      return derivedData;
 +      }
 +
 +      result = fluidsimModifier_do(fluidmd, ob, derivedData, useRenderParams, isFinalCalc);
 +
 +      if(result) 
 +      { 
 +              return result; 
 +      }
 +      
 +      return derivedData;
 +}
 +
 +static void fluidsimModifier_updateDepgraph(
 +              ModifierData *md, DagForest *forest,
 +      Object *ob, DagNode *obNode)
 +{
 +      FluidsimModifierData *fluidmd= (FluidsimModifierData*) md;
 +      Base *base;
 +
 +      if(fluidmd && fluidmd->fss)
 +      {
 +              if(fluidmd->fss->type == OB_FLUIDSIM_DOMAIN)
 +              {
 +                      for(base = G.scene->base.first; base; base= base->next) 
 +                      {
 +                              Object *ob1= base->object;
 +                              if(ob1 != ob)
 +                              {
 +                                      FluidsimModifierData *fluidmdtmp = (FluidsimModifierData *)modifiers_findByType(ob1, eModifierType_Fluidsim);
 +                                      
 +                                      // only put dependancies from NON-DOMAIN fluids in here
 +                                      if(fluidmdtmp && fluidmdtmp->fss && (fluidmdtmp->fss->type!=OB_FLUIDSIM_DOMAIN))
 +                                      {
 +                                              DagNode *curNode = dag_get_node(forest, ob1);
 +                                              dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Fluidsim Object");
 +                                      }
 +                              }
 +                      }
 +              }
 +      }
 +}
 +
 +static int fluidsimModifier_dependsOnTime(ModifierData *md) 
 +{
 +      return 1;
 +}
 +
  /* MeshDeform */
  
  static void meshdeformModifier_initData(ModifierData *md)
@@@ -7643,17 -7556,6 +7644,17 @@@ ModifierTypeInfo *modifierType_getInfo(
                mti->dependsOnTime = explodeModifier_dependsOnTime;
                mti->requiredDataMask = explodeModifier_requiredDataMask;
                mti->applyModifier = explodeModifier_applyModifier;
 +              
 +              mti = INIT_TYPE(Fluidsim);
 +              mti->type = eModifierTypeType_Nonconstructive
 +                              | eModifierTypeFlag_RequiresOriginalData;
 +              mti->flags = eModifierTypeFlag_AcceptsMesh;
 +              mti->initData = fluidsimModifier_initData;
 +              mti->freeData = fluidsimModifier_freeData;
 +              mti->copyData = fluidsimModifier_copyData;
 +              mti->dependsOnTime = fluidsimModifier_dependsOnTime;
 +              mti->applyModifier = fluidsimModifier_applyModifier;
 +              mti->updateDepgraph = fluidsimModifier_updateDepgraph;
  
                typeArrInit = 0;
  #undef INIT_TYPE
index 2149e541263fb1e3650b7dd3ea19cb95b20f7237,d1c0cdec71ddba7556b8c3abe640c2cbf876c872..b399fdd61d227b26c88f47ade60c607ade72c98d
@@@ -4543,7 -4543,7 +4543,7 @@@ void psys_changed_type(ParticleSystem *
  }
  
  static void particles_fluid_step(Object *ob, ParticleSystem *psys, int cfra)
 -{
 +{     
        if(psys->particles){
                MEM_freeN(psys->particles);
                psys->particles = 0;
  
        /* fluid sim particle import handling, actual loading of particles from file */
        #ifndef DISABLE_ELBEEM
 -      if( (1) && (ob->fluidsimFlag & OB_FLUIDSIM_ENABLE) &&  // broken, disabled for now!
 -              (ob->fluidsimSettings)) { 
 -              ParticleSettings *part = psys->part;
 -              ParticleData *pa=0;
 -              char *suffix  = "fluidsurface_particles_####";
 -              char *suffix2 = ".gz";
 -              char filename[256];
 -              char debugStrBuffer[256];
 -              int  curFrame = G.scene->r.cfra -1; // warning - sync with derived mesh fsmesh loading
 -              int  p, j, numFileParts, totpart;
 -              int readMask, activeParts = 0, fileParts = 0;
 -              gzFile gzf;
 -
 -              if(ob==G.obedit) // off...
 -                      return;
 -
 -              // ok, start loading
 -              strcpy(filename, ob->fluidsimSettings->surfdataPath);
 -              strcat(filename, suffix);
 -              BLI_convertstringcode(filename, G.sce);
 -              BLI_convertstringframe(filename, curFrame); // fixed #frame-no 
 -              strcat(filename, suffix2);
 -
 -              gzf = gzopen(filename, "rb");
 -              if (!gzf) {
 -                      snprintf(debugStrBuffer,256,"readFsPartData::error - Unable to open file for reading '%s' \n", filename); 
 -                      //elbeemDebugOut(debugStrBuffer);
 -                      return;
 -              }
 -
 -              gzread(gzf, &totpart, sizeof(totpart));
 -              numFileParts = totpart;
 -              totpart = (G.rendering)?totpart:(part->disp*totpart)/100;
 +      {
 +              FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim);
                
 -              part->totpart= totpart;
 -              part->sta=part->end = 1.0f;
 -              part->lifetime = G.scene->r.efra + 1;
 -
 -              /* initialize particles */
 -              realloc_particles(ob, psys, part->totpart);
 -              initialize_all_particles(ob, psys, 0);
 -
 -              // set up reading mask
 -              readMask = ob->fluidsimSettings->typeFlags;
 -              
 -              for(p=0, pa=psys->particles; p<totpart; p++, pa++) {
 -                      int ptype=0;
 -
 -                      gzread(gzf, &ptype, sizeof( ptype )); 
 -                      if(ptype&readMask) {
 -                              activeParts++;
 -
 -                              gzread(gzf, &(pa->size), sizeof( float )); 
 -
 -                              pa->size /= 10.0f;
 -
 -                              for(j=0; j<3; j++) {
 -                                      float wrf;
 -                                      gzread(gzf, &wrf, sizeof( wrf )); 
 -                                      pa->state.co[j] = wrf;
 -                                      //fprintf(stderr,"Rj%d ",j);
 -                              }
 -                              for(j=0; j<3; j++) {
 -                                      float wrf;
 -                                      gzread(gzf, &wrf, sizeof( wrf )); 
 -                                      pa->state.vel[j] = wrf;
 -                              }
 -
 -                              pa->state.ave[0] = pa->state.ave[1] = pa->state.ave[2] = 0.0f;
 -                              pa->state.rot[0] = 1.0;
 -                              pa->state.rot[1] = pa->state.rot[2] = pa->state.rot[3] = 0.0;
 -
 -                              pa->alive = PARS_ALIVE;
 -                              //if(a<25) fprintf(stderr,"FSPARTICLE debug set %s , a%d = %f,%f,%f , life=%f \n", filename, a, pa->co[0],pa->co[1],pa->co[2], pa->lifetime );
 -                      } else {
 -                              // skip...
 -                              for(j=0; j<2*3+1; j++) {
 -                                      float wrf; gzread(gzf, &wrf, sizeof( wrf )); 
 +              if( fluidmd && fluidmd->fss) { 
 +                      FluidsimSettings *fss= fluidmd->fss;
 +                      ParticleSettings *part = psys->part;
 +                      ParticleData *pa=0;
 +                      char *suffix  = "fluidsurface_particles_####";
 +                      char *suffix2 = ".gz";
 +                      char filename[256];
 +                      char debugStrBuffer[256];
 +                      int  curFrame = G.scene->r.cfra -1; // warning - sync with derived mesh fsmesh loading
 +                      int  p, j, numFileParts, totpart;
 +                      int readMask, activeParts = 0, fileParts = 0;
 +                      gzFile gzf;
 +      
 +                      if(ob==G.obedit) // off...
 +                              return;
 +      
 +                      // ok, start loading
 +                      strcpy(filename, fss->surfdataPath);
 +                      strcat(filename, suffix);
 +                      BLI_convertstringcode(filename, G.sce);
 +                      BLI_convertstringframe(filename, curFrame); // fixed #frame-no 
 +                      strcat(filename, suffix2);
 +      
 +                      gzf = gzopen(filename, "rb");
 +                      if (!gzf) {
 +                              snprintf(debugStrBuffer,256,"readFsPartData::error - Unable to open file for reading '%s' \n", filename); 
 +                              //elbeemDebugOut(debugStrBuffer);
 +                              return;
 +                      }
 +      
 +                      gzread(gzf, &totpart, sizeof(totpart));
 +                      numFileParts = totpart;
 +                      totpart = (G.rendering)?totpart:(part->disp*totpart)/100;
 +                      
 +                      part->totpart= totpart;
 +                      part->sta=part->end = 1.0f;
 +                      part->lifetime = G.scene->r.efra + 1;
 +      
 +                      /* initialize particles */
 +                      realloc_particles(ob, psys, part->totpart);
 +                      initialize_all_particles(ob, psys, 0);
 +      
 +                      // set up reading mask
 +                      readMask = fss->typeFlags;
 +                      
 +                      for(p=0, pa=psys->particles; p<totpart; p++, pa++) {
 +                              int ptype=0;
 +      
 +                              gzread(gzf, &ptype, sizeof( ptype )); 
 +                              if(ptype&readMask) {
 +                                      activeParts++;
 +      
 +                                      gzread(gzf, &(pa->size), sizeof( float )); 
 +      
 +                                      pa->size /= 10.0f;
 +      
 +                                      for(j=0; j<3; j++) {
 +                                              float wrf;
 +                                              gzread(gzf, &wrf, sizeof( wrf )); 
 +                                              pa->state.co[j] = wrf;
 +                                              //fprintf(stderr,"Rj%d ",j);
 +                                      }
 +                                      for(j=0; j<3; j++) {
 +                                              float wrf;
 +                                              gzread(gzf, &wrf, sizeof( wrf )); 
 +                                              pa->state.vel[j] = wrf;
 +                                      }
 +      
 +                                      pa->state.ave[0] = pa->state.ave[1] = pa->state.ave[2] = 0.0f;
 +                                      pa->state.rot[0] = 1.0;
 +                                      pa->state.rot[1] = pa->state.rot[2] = pa->state.rot[3] = 0.0;
 +      
 +                                      pa->alive = PARS_ALIVE;
 +                                      //if(a<25) fprintf(stderr,"FSPARTICLE debug set %s , a%d = %f,%f,%f , life=%f \n", filename, a, pa->co[0],pa->co[1],pa->co[2], pa->lifetime );
 +                              } else {
 +                                      // skip...
 +                                      for(j=0; j<2*3+1; j++) {
 +                                              float wrf; gzread(gzf, &wrf, sizeof( wrf )); 
 +                                      }
                                }
 +                              fileParts++;
                        }
 -                      fileParts++;
 -              }
 -              gzclose( gzf );
 -
 -              totpart = psys->totpart = activeParts;
 -              snprintf(debugStrBuffer,256,"readFsPartData::done - particles:%d, active:%d, file:%d, mask:%d  \n", psys->totpart,activeParts,fileParts,readMask);
 -              elbeemDebugOut(debugStrBuffer);
 -      } // fluid sim particles done
 +                      gzclose( gzf );
 +      
 +                      totpart = psys->totpart = activeParts;
 +                      snprintf(debugStrBuffer,256,"readFsPartData::done - particles:%d, active:%d, file:%d, mask:%d  \n", psys->totpart,activeParts,fileParts,readMask);
 +                      elbeemDebugOut(debugStrBuffer);
 +              } // fluid sim particles done
 +      }
        #endif // DISABLE_ELBEEM
  }
  
@@@ -4657,7 -4653,7 +4657,7 @@@ static void system_step(Object *ob, Par
        PTCacheID pid;
        int totpart, oldtotpart, totchild, oldtotchild, p;
        float disp, *vg_vel= 0, *vg_tan= 0, *vg_rot= 0, *vg_size= 0;
-       int init= 0, distr= 0, alloc= 0, usecache= 0;
+       int init= 0, distr= 0, alloc= 0, usecache= 0, only_children_changed= 0;
        int framenr, framedelta, startframe, endframe;
  
        part= psys->part;
        totchild = get_psys_tot_child(psys);
  
        if(oldtotpart != totpart || (psys->part->childtype && oldtotchild != totchild)) {
+               only_children_changed = (oldtotpart == totpart);
                realloc_particles(ob, psys, totpart);
                alloc = 1;
                distr= 1;
  
                        if((psys->part->type == PART_HAIR) && !(psys->flag & PSYS_HAIR_DONE))
                        /* don't generate children while growing hair - waste of time */
-                       psys_free_children(psys);
-               else if(get_psys_tot_child(psys))
-                       distribute_particles(ob, psys, PART_FROM_CHILD);
+                               psys_free_children(psys);
+                       else if(get_psys_tot_child(psys))
+                               distribute_particles(ob, psys, PART_FROM_CHILD);
                }
-               initialize_all_particles(ob, psys, psmd);
  
-               if(alloc)
-                       reset_all_particles(ob, psys, psmd, 0.0, cfra, oldtotpart);
+               if(only_children_changed==0) {
+                       initialize_all_particles(ob, psys, psmd);
+                       if(alloc)
+                               reset_all_particles(ob, psys, psmd, 0.0, cfra, oldtotpart);
+               }
  
                /* flag for possible explode modifiers after this system */
                psmd->flag |= eParticleSystemFlag_Pars;
index c54ad22204118ce9b49b232aabde91dca432479c,cb6f7e629fa42e9fd9c9bfa9982d151d8d09397c..d11edc631d6e30417d73686bc5ed668aa9627473
@@@ -985,7 -985,7 +985,7 @@@ static uiBlock *modifiers_add_menu(voi
                /* Only allow adding through appropriate other interfaces */
                if(ELEM3(i, eModifierType_Softbody, eModifierType_Hook, eModifierType_ParticleSystem)) continue;
                
 -              if(ELEM(i, eModifierType_Cloth, eModifierType_Collision)) continue;
 +              if(ELEM3(i, eModifierType_Cloth, eModifierType_Collision, eModifierType_Fluidsim)) continue;
  
                if((mti->flags&eModifierTypeFlag_AcceptsCVs) ||
                   (ob->type==OB_MESH && (mti->flags&eModifierTypeFlag_AcceptsMesh))) {
@@@ -1742,7 -1742,7 +1742,7 @@@ static void draw_modifier(uiBlock *bloc
                
                // deletion over the deflection panel
                // fluid particle modifier can't be deleted here
 -              if(md->type!=eModifierType_Collision && !modifier_is_fluid_particles(md))
 +              if(md->type!=eModifierType_Fluidsim && md->type!=eModifierType_Collision && !modifier_is_fluid_particles(md))
                {
                        but = uiDefIconBut(block, BUT, B_MODIFIER_RECALC, VICON_X, x+width-70+40, y, 16, 16, NULL, 0.0, 0.0, 0.0, 0.0, "Delete modifier");
                        uiButSetFunc(but, modifiers_del, ob, md);
                        height = 31;
                } else if (md->type==eModifierType_Collision) {
                        height = 31;
 +              } else if (md->type==eModifierType_Fluidsim) {
 +                      height = 31;
                } else if (md->type==eModifierType_Boolean) {
                        height = 48;
                } else if (md->type==eModifierType_Array) {
                                uiButSetFunc(but, modifiers_applyModifier, ob, md);
                        }
                        
 -                      if (md->type!=eModifierType_Softbody && md->type!=eModifierType_ParticleSystem && (md->type!=eModifierType_Cloth)) {
 +                      if (md->type!=eModifierType_Fluidsim && md->type!=eModifierType_Softbody && md->type!=eModifierType_ParticleSystem && (md->type!=eModifierType_Cloth)) {
                                but = uiDefBut(block, BUT, B_MODIFIER_RECALC, "Copy",   lx,(cy-=19),60,19, 0, 0, 0, 0, 0, "Duplicate the current modifier at the same position in the stack");
                                uiButSetFunc(but, modifiers_copyModifier, ob, md);
                        }
                        uiDefBut(block, LABEL, 1, "See Cloth panel.",   lx, (cy-=19), buttonWidth,19, NULL, 0.0, 0.0, 0, 0, "");
                } else if (md->type==eModifierType_Collision) {
                        uiDefBut(block, LABEL, 1, "See Collision panel.",       lx, (cy-=19), buttonWidth,19, NULL, 0.0, 0.0, 0, 0, "");
 +              } else if (md->type==eModifierType_Fluidsim) {
 +                      uiDefBut(block, LABEL, 1, "See Fluidsim panel.",        lx, (cy-=19), buttonWidth,19, NULL, 0.0, 0.0, 0, 0, "");
                } else if (md->type==eModifierType_Boolean) {
                        BooleanModifierData *bmd = (BooleanModifierData*) md;
                        uiDefButI(block, MENU, B_MODIFIER_RECALC, "Operation%t|Intersect%x0|Union%x1|Difference%x2",    lx,(cy-=19),buttonWidth,19, &bmd->operation, 0.0, 1.0, 0, 0, "Boolean operation to perform");
@@@ -5675,13 -5671,9 +5675,9 @@@ void sculptmode_draw_interface_textures
  
  void do_fpaintbuts(unsigned short event)
  {
-       Mesh *me;
        Object *ob;
        bDeformGroup *defGroup;
-       MTFace *activetf, *tf;
-       MFace *mf;
-       MCol *activemcol;
-       int a;
+       MTFace *activetf;
        SculptData *sd= &G.scene->sculptdata;
        ID *id, *idtest;
        extern VPaint Gwp;         /* from vpaint */
                vpaint_dogamma();
                break;
        case B_COPY_TF_MODE:
+               EM_mesh_copy_face(4); /* todo, get rid of magic numbers */
+               break;
+       case B_COPY_TF_TRANSP:
+               EM_mesh_copy_face(5);
+               break;
        case B_COPY_TF_UV:
+               EM_mesh_copy_face(3);
+               break;
        case B_COPY_TF_COL:
+               EM_mesh_copy_face(6);
+               break;
        case B_COPY_TF_TEX:
-               me= get_mesh(OBACT);
-               activetf= get_active_mtface(NULL, &activemcol, 0);
-               if(me && activetf) {
-                       for (a=0, tf=me->mtface, mf=me->mface; a < me->totface; a++, tf++, mf++) {
-                               if(tf!=activetf && (mf->flag & ME_FACE_SEL)) {
-                                       if(event==B_COPY_TF_MODE) {
-                                               tf->mode= activetf->mode;
-                                               tf->transp= activetf->transp;
-                                       }
-                                       else if(event==B_COPY_TF_UV) {
-                                               memcpy(tf->uv, activetf->uv, sizeof(tf->uv));
-                                               tf->tpage= activetf->tpage;
-                                               tf->tile= activetf->tile;
-                                               if(activetf->mode & TF_TILES) tf->mode |= TF_TILES;
-                                               else tf->mode &= ~TF_TILES;
-                                       }
-                                       else if(event==B_COPY_TF_TEX) {
-                                               tf->tpage= activetf->tpage;
-                                               tf->tile= activetf->tile;
-                                               if(activetf->mode & TF_TILES) tf->mode |= TF_TILES;
-                                               else tf->mode &= ~TF_TILES;
-                                       }
-                                       else if(event==B_COPY_TF_COL && activemcol)
-                                               memcpy(&me->mcol[a*4], activemcol, sizeof(MCol)*4);
-                               }
-                       }
-                       DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
-                       do_shared_vertexcol(me);
-                       allqueue(REDRAWVIEW3D, 0);
-                       allqueue(REDRAWIMAGE, 0);
-               }
+               EM_mesh_copy_face(2);
                break;
        case B_SET_VCOL:
                if(FACESEL_PAINT_TEST) 
@@@ -6174,8 -6140,20 +6144,20 @@@ static void editing_panel_mesh_texface(
        if(uiNewPanel(curarea, block, "Texture Face", "Editing", 960, 0, 318, 204)==0) return;
        
        tf = get_active_mtface(NULL, NULL, 0);
+       
        if(tf) {
+               uiDefBut(block, LABEL, B_NOP, "Active Face Mode",       600,185,300,19, NULL, 0.0, 0.0, 0, 0, "Face mode its used for TexFace display and the game engine ");
+               uiDefBut(block, BUT,B_COPY_TF_MODE, "Copy", 850,185,50,19, 0, 0, 0, 0, 0, "Copy active faces mode to other selected (View3D Ctrl+C)");
+               
+               /* Other copy buttons, layout isnt that nice */
                uiBlockBeginAlign(block);
+               uiDefBut(block, BUT,B_COPY_TF_UV, "CopyUV", 600,15,100,19, 0, 0, 0, 0, 0, "Copy active faces UVs to other selected (View3D Ctrl+C)");
+               uiDefBut(block, BUT,B_COPY_TF_TEX, "CopyTex", 700,15,100,19, 0, 0, 0, 0, 0, "Copy active faces Texture to other selected (View3D Ctrl+C)");             
+               uiDefBut(block, BUT,B_COPY_TF_COL, "CopyColor", 800,15,100,19, 0, 0, 0, 0, 0, "Copy active faces Color to other selected (View3D Ctrl+C)");
+               uiBlockEndAlign(block);
+               
+               uiBlockBeginAlign(block);
+               
                uiDefButBitS(block, TOG, TF_TEX, B_REDR_3D_IMA, "Tex",  600,160,60,19, &tf->mode, 0, 0, 0, 0, "Render face with texture");
                uiDefButBitS(block, TOG, TF_TILES, B_REDR_3D_IMA, "Tiles",      660,160,60,19, &tf->mode, 0, 0, 0, 0, "Use tilemode for face");
                uiDefButBitS(block, TOG, TF_LIGHT, REDRAWVIEW3D, "Light",       720,160,60,19, &tf->mode, 0, 0, 0, 0, "Use light for face");
                uiDefButBitS(block, TOG, TF_SHAREDCOL, REDRAWVIEW3D, "Shared",  600,135,60,19, &tf->mode, 0, 0, 0, 0, "Blend vertex colors across face when vertices are shared");
                uiDefButBitS(block, TOG, TF_TWOSIDE, REDRAWVIEW3D, "Twoside",660,135,60,19, &tf->mode, 0, 0, 0, 0, "Render face twosided");
                uiDefButBitS(block, TOG, TF_OBCOL, REDRAWVIEW3D, "ObColor",720,135,60,19, &tf->mode, 0, 0, 0, 0, "Use ObColor instead of vertex colors");
-               uiBlockBeginAlign(block);
+               uiBlockEndAlign(block);
                
+               uiBlockBeginAlign(block);
                uiDefButBitS(block, TOG, TF_BILLBOARD, B_TFACE_HALO, "Halo",    600,110,60,19, &tf->mode, 0, 0, 0, 0, "Screen aligned billboard");
                uiDefButBitS(block, TOG, TF_BILLBOARD2, B_TFACE_BILLB, "Billboard",660,110,60,19, &tf->mode, 0, 0, 0, 0, "Billboard with Z-axis constraint");
                uiDefButBitS(block, TOG, TF_SHADOW, REDRAWVIEW3D, "Shadow", 720,110,60,19, &tf->mode, 0, 0, 0, 0, "Face is used for shadow");
                uiDefButBitS(block, TOG, TF_BMFONT, REDRAWVIEW3D, "Text", 780,110,60,19, &tf->mode, 0, 0, 0, 0, "Enable bitmap text on face");
                uiDefButBitS(block, TOG, TF_ALPHASORT, REDRAWVIEW3D, "Sort", 840,110,60,19, &tf->mode, 0, 0, 0, 0, "Enable sorting of faces for correct alpha drawing (slow, use Clip Alpha instead when possible)");
+               uiBlockEndAlign(block);
+               
+               uiDefBut(block, LABEL, B_NOP, "Active Face Alpha Blending (Transp)",    600,75,300,19, NULL, 0.0, 0.0, 0, 0, "Face mode its used for TexFace display and the game engine");
+               uiDefBut(block, BUT,B_COPY_TF_TRANSP, "Copy", 850,75,50,19, 0, 0, 0, 0, 0, "Copy active faces transp to other selected (View3D Ctrl+C)");
+               
                uiBlockBeginAlign(block);
                uiBlockSetCol(block, TH_BUT_SETTING1);
-               uiDefButC(block, ROW, REDRAWVIEW3D, "Opaque",   600,80,60,19, &tf->transp, 2.0, (float)TF_SOLID,0, 0, "Render color of textured face as color");
-               uiDefButC(block, ROW, REDRAWVIEW3D, "Add",              660,80,60,19, &tf->transp, 2.0, (float)TF_ADD,  0, 0, "Render face transparent and add color of face");
-               uiDefButC(block, ROW, REDRAWVIEW3D, "Alpha",    720,80,60,19, &tf->transp, 2.0, (float)TF_ALPHA,0, 0, "Render polygon transparent, depending on alpha channel of the texture");
-               uiDefButC(block, ROW, REDRAWVIEW3D, "Clip Alpha",       780,80,80,19, &tf->transp, 2.0, (float)TF_CLIP,0, 0, "Use the images alpha values clipped with no blending (binary alpha)");
-       }
-       else
+               uiDefButC(block, ROW, REDRAWVIEW3D, "Opaque",           600,50,60,19, &tf->transp, 2.0, (float)TF_SOLID,0, 0, "Render color of textured face as color");
+               uiDefButC(block, ROW, REDRAWVIEW3D, "Add",                      660,50,60,19, &tf->transp, 2.0, (float)TF_ADD,  0, 0, "Render face transparent and add color of face");
+               uiDefButC(block, ROW, REDRAWVIEW3D, "Alpha",            720,50,60,19, &tf->transp, 2.0, (float)TF_ALPHA,0, 0, "Render polygon transparent, depending on alpha channel of the texture");
+               uiDefButC(block, ROW, REDRAWVIEW3D, "Clip Alpha",       780,50,80,19, &tf->transp, 2.0, (float)TF_CLIP,0, 0,  "Use the images alpha values clipped with no blending (binary alpha)");
+               uiBlockEndAlign(block);
+               
+       } else {
                uiDefBut(block,LABEL,B_NOP, "(No Active Face)", 10,200,150,19,0,0,0,0,0,"");
+       }
  
  }