svn merge -r 12691:12716 https://svn.blender.org/svnroot/bf-blender/trunk/blender
authorDaniel Genrich <daniel.genrich@gmx.net>
Thu, 29 Nov 2007 12:40:53 +0000 (12:40 +0000)
committerDaniel Genrich <daniel.genrich@gmx.net>
Thu, 29 Nov 2007 12:40:53 +0000 (12:40 +0000)
1  2 
source/blender/blenloader/intern/readfile.c
source/blender/include/butspace.h
source/blender/src/buttons_editing.c
source/blender/src/buttons_object.c
source/blender/src/editobject.c
source/gameengine/Converter/KX_BlenderSceneConverter.cpp
tools/btools.py

index 35562a11db5b6e0ac14ef3bfdbc0278854872679,ff2a4edab9d224a527d12c807640276a1f646d29..81ae152a17ccfbbeafda6345c1ed21d575065162
@@@ -60,7 -60,6 +60,7 @@@
  #include "DNA_actuator_types.h"
  #include "DNA_brush_types.h"
  #include "DNA_camera_types.h"
 +#include "DNA_cloth_types.h"
  #include "DNA_color_types.h"
  #include "DNA_controller_types.h"
  #include "DNA_constraint_types.h"
  
  #include "BKE_action.h"
  #include "BKE_armature.h"
 +#include "BKE_cloth.h"
  #include "BKE_colortools.h"
  #include "BKE_constraint.h"
  #include "BKE_curve.h"
@@@ -1621,7 -1619,9 +1621,9 @@@ static void lib_link_constraints(FileDa
                if(con->data==NULL) {
                        con->type= CONSTRAINT_TYPE_NULL;
                }
+               /* own ipo, all constraints have it */
+               con->ipo= newlibadr(fd, id->lib, con->ipo);
+               
                switch (con->type) {
                case CONSTRAINT_TYPE_PYTHON:
                        {
@@@ -2962,28 -2962,7 +2964,28 @@@ static void direct_link_modifiers(FileD
                        SubsurfModifierData *smd = (SubsurfModifierData*) md;
  
                        smd->emCache = smd->mCache = 0;
 -              } else if (md->type==eModifierType_Hook) {
 +              } 
 +              else if (md->type==eModifierType_Cloth) {
 +                 ClothModifierData    *clmd = (ClothModifierData*) md;
 +
 +                 clmd->clothObject = NULL;
 +                 
 +                 clmd->sim_parms= newdataadr(fd, clmd->sim_parms);
 +                 clmd->coll_parms= newdataadr(fd, clmd->coll_parms);
 +                 
 +              } 
 +              else if (md->type==eModifierType_Collision) {
 +                      CollisionModifierData *collmd = (CollisionModifierData*) md;
 +                      
 +                      collmd->x = NULL;
 +                      collmd->xnew = NULL;
 +                      collmd->current_x = NULL;
 +                      collmd->current_xnew = NULL;
 +                      collmd->time = -1;
 +                      collmd->numverts = 0;
 +                      collmd->tree = NULL;
 +              }
 +              else if (md->type==eModifierType_Hook) {
                        HookModifierData *hmd = (HookModifierData*) md;
  
                        hmd->indexar= newdataadr(fd, hmd->indexar);
  
                        psmd->dm=0;
                        psmd->psys=newdataadr(fd, psmd->psys);
-                       psmd->flag|=eParticleSystemFlag_Loaded;
+                       psmd->flag |= eParticleSystemFlag_Loaded;
+                       psmd->flag &= ~eParticleSystemFlag_psys_updated;
                } else if (md->type==eModifierType_Explode) {
                        ExplodeModifierData *psmd = (ExplodeModifierData*) md;
  
@@@ -3128,6 -3108,7 +3131,6 @@@ static void direct_link_object(FileDat
                sb->bpoint= NULL;       // init pointers so it gets rebuilt nicely
                sb->bspring= NULL;
                sb->scratch= NULL;
 -
                /* although not used anymore */
                /* still have to be loaded to be compatible with old files */
                sb->keys= newdataadr(fd, sb->keys);
@@@ -7189,6 -7170,16 +7192,16 @@@ static void do_versions(FileData *fd, L
                        }
                }
        }
+       if ((main->versionfile < 245) || (main->versionfile == 245 && main->subversionfile < 9)) {
+               Material *ma;
+               int a;
+               for(ma=main->mat.first; ma; ma= ma->id.next)
+                       if(ma->mode & MA_NORMAP_TANG)
+                               for(a=0; a<MAX_MTEX; a++)
+                                       if(ma->mtex[a] && ma->mtex[a]->tex)
+                                               ma->mtex[a]->normapspace = MTEX_NSPACE_TANGENT;
+       }
        /* WATCH IT!!!: pointers from libdata have not been converted yet here! */
        /* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */
  
index 3666067ee2ce129bf379695586288e7ecf1b3966,debac14f63e996505342c3af4d336e7835092310..a23ac48d7c24020448757f3b56c87cfeb0710132
@@@ -87,7 -87,6 +87,6 @@@ extern int mod_moveDown(void *ob_v, voi
  extern void const_moveUp(void *ob_v, void *con_v);
  extern void const_moveDown(void *ob_v, void *con_v);
  extern void del_constr_func (void *ob_v, void *con_v);
- extern void get_constraint_ipo_context(void *ob_v, char *actname);
  
  /* editing */
  extern void editing_panels(void);
@@@ -288,13 -287,6 +287,13 @@@ void curvemap_buttons(struct uiBlock *b
  
  #define B_BAKEABLE_CHANGE             1470
  
 +/* Cloth sim button defines */
 +#define B_CLOTH_CLEARCACHEALL 1480
 +#define B_CLOTH_CLEARCACHEFRAME       1481
 +#define B_CLOTH_CHANGEPREROLL 1482
 +#define B_CLOTH_DEL_VG                1483
 +#define B_CLOTH_RENEW                 1484
 +
  /* *********************** */
  #define B_WORLDBUTS           1600
  
  #define B_DOCENTER            2015
  #define B_DOCENTERNEW         2016
  #define B_DOCENTERCURSOR      2017
+ #define B_MATASS_BROWSE       2018
  
        /* 20 values! */
  #define B_OBLAY                       2019
  #define B_PREVKEY             2045
  #define B_NEXTKEY             2046
  #define B_LOCKKEY             2047
+ #define B_MATCOL2             2048
  
  #define B_MESHBUTS            2090
  
index 83f04110974033e22e732f512776933cb36a8d58,3855ae7de7d6a0cdbf76aaee0d28df05a4ab0336..9ffb7578980a94f7b549a8252010f3b9049d6415
  #include "BKE_DerivedMesh.h"
  #include "BKE_effect.h"
  #include "BKE_font.h"
+ #include "BKE_icons.h"
  #include "BKE_image.h"
  #include "BKE_ipo.h"
  #include "BKE_lattice.h"
@@@ -388,6 -389,7 +389,7 @@@ void do_common_editbuts(unsigned short 
        EditFace *efa;
        Base *base;
        Object *ob= OBACT;
+       Material *ma;
        Nurb *nu;
        Curve *cu;
        BezTriple *bezt;
        case B_MATWICH:
                if(G.obedit && G.obedit->actcol>0) {
                        if(G.obedit->type == OB_MESH) {
-                               efa= em->faces.first;
-                               while(efa) {
+                               for(efa= em->faces.first; efa; efa= efa->next) {
                                        if(efa->f & SELECT) {
                                                if(index== -1) index= efa->mat_nr;
                                                else if(index!=efa->mat_nr) {
                        BIF_undo_push("Assign material index");
                }
                break;
+       case B_MATASS_BROWSE:
+               /* if slot available, make that index active, and assign */
+               /* else, make new slot, and assign */
+               ma= BLI_findlink(&G.main->mat, G.buts->menunr-1);
+               if(ma) {
+                       ob->actcol= find_material_index(ob, ma);
+                       if(ob->actcol==0) {
+                               assign_material(ob, ma, ob->totcol);
+                               ob->actcol= ob->totcol;
+                       }
+               }
+               else {
+                       do_common_editbuts(B_MATNEW);
+               }
+               do_common_editbuts(B_MATASS);
+               break;
+               
+       case B_MATCOL2:
+               ma= give_current_material(ob, ob->actcol);
+               BKE_icon_changed(BKE_icon_getid((ID *)ma));
+               allqueue(REDRAWVIEW3D, 0);
+               allqueue(REDRAWBUTSEDIT, 0);
+               break;
+               
        case B_MATSEL:
        case B_MATDESEL:
                if(G.obedit) {
@@@ -955,8 -980,6 +980,8 @@@ 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((mti->flags&eModifierTypeFlag_AcceptsCVs) ||
                   (ob->type==OB_MESH && (mti->flags&eModifierTypeFlag_AcceptsMesh))) {
@@@ -1645,7 -1668,7 +1670,7 @@@ static void draw_modifier(uiBlock *bloc
        uiBlockSetCol(block, TH_AUTO);
        
        /* open/close icon */
 -      if (!isVirtual) {
 +      if (!isVirtual && md->type!=eModifierType_Collision) {
                uiBlockSetEmboss(block, UI_EMBOSSN);
                uiDefIconButBitI(block, ICONTOG, eModifierMode_Expanded, B_MODIFIER_REDRAW, VICON_DISCLOSURE_TRI_RIGHT, x-10, y-2, 20, 20, &md->mode, 0.0, 0.0, 0.0, 0.0, "Collapse/Expand Modifier");
        }
                uiBlockBeginAlign(block);
                uiDefBut(block, TEX, B_MODIFIER_REDRAW, "", x+10, y-1, buttonWidth-60, 19, md->name, 0.0, sizeof(md->name)-1, 0.0, 0.0, "Modifier name"); 
  
 -                      /* Softbody not allowed in this situation, enforce! */
 -              if (md->type!=eModifierType_Softbody || !(ob->pd && ob->pd->deflect)) {
 +              /* Softbody not allowed in this situation, enforce! */
 +              if ((md->type!=eModifierType_Softbody && md->type!=eModifierType_Collision) || !(ob->pd && ob->pd->deflect)) {
                        uiDefIconButBitI(block, TOG, eModifierMode_Render, B_MODIFIER_RECALC, ICON_SCENE, x+10+buttonWidth-60, y-1, 19, 19,&md->mode, 0, 0, 1, 0, "Enable modifier during rendering");
                        but= uiDefIconButBitI(block, TOG, eModifierMode_Realtime, B_MODIFIER_RECALC, VICON_VIEW3D, x+10+buttonWidth-40, y-1, 19, 19,&md->mode, 0, 0, 1, 0, "Enable modifier during interactive display");
                        if (md->type==eModifierType_ParticleSystem)
                uiButSetFunc(but, modifiers_moveDown, ob, md);
                
                uiBlockSetEmboss(block, UI_EMBOSSN);
 -
 -              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);
 +              
 +              // deletion over the deflection panel
 +              if(md->type!=eModifierType_Collision)
 +              {
 +                      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);
 +              }
                uiBlockSetCol(block, TH_AUTO);
        }
  
                                height += 20;
                } else if (md->type==eModifierType_Softbody) {
                        height = 31;
 +              } else if (md->type==eModifierType_Cloth) {
 +                      height = 26;
 +              } else if (md->type==eModifierType_Collision) {
 +                      height = 19;
                } else if (md->type==eModifierType_Boolean) {
                        height = 48;
                } else if (md->type==eModifierType_Array) {
                } else if (md->type==eModifierType_Explode) {
                        height = 94;
                }
 -
                                                        /* roundbox 4 free variables: corner-rounding, nop, roundbox type, shade */
                uiDefBut(block, ROUNDBOX, 0, "", x-10, y-height-2, width, height-2, NULL, 5.0, 0.0, 12, 40, ""); 
  
                y -= 18;
  
 -              if (!isVirtual) {
 +              if (!isVirtual && (md->type!=eModifierType_Collision)) {
                        uiBlockBeginAlign(block);
                        if (md->type==eModifierType_ParticleSystem) {
                                but = uiDefBut(block, BUT, B_MODIFIER_RECALC, "Convert",        lx,(cy-=19),60,19, 0, 0, 0, 0, 0, "Convert the current particles to a mesh object");
                                uiButSetFunc(but, modifiers_applyModifier, ob, md);
                        }
                        
 -                      if (md->type!=eModifierType_Softbody && md->type!=eModifierType_ParticleSystem) {
 +                      if (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);
                        }
                                  "Material value that gives no displacement");
                        uiDefButF(block, NUM, B_MODIFIER_RECALC, "Strength:",
                                  lx, (cy -= 19), buttonWidth, 19, &dmd->strength,
-                                 -1000, 1000, 10, 10,
+                                 -1000, 1000, 10, 0.1,
                                  "Strength of displacement");
                        sprintf(str, "Direction%%t|Normal%%x%d|RGB -> XYZ%%x%d|"
                                "Z%%x%d|Y%%x%d|X%%x%d",
@@@ -3606,9 -3622,6 +3631,9 @@@ void do_latticebuts(unsigned short even
                        if(ob==G.obedit) resizelattice(editLatt, lt->opntsu, lt->opntsv, lt->opntsw, NULL);
                        else resizelattice(ob->data, lt->opntsu, lt->opntsv, lt->opntsw, NULL);
                        ob->softflag |= OB_SB_REDO;
 +                      if(modifiers_isClothEnabled(ob)) {
 +                              cloth_free_modifier(modifiers_isClothEnabled(ob));
 +                      }
                        DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
                        allqueue(REDRAWVIEW3D, 0);
                }
                        lt = ob->data;
                        resizelattice(ob->data, lt->opntsu, lt->opntsv, lt->opntsw, ob);
                        ob->softflag |= OB_SB_REDO;
 +                      if(modifiers_isClothEnabled(ob)) {
 +                              cloth_free_modifier(modifiers_isClothEnabled(ob));
 +                      }
                        DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
                        allqueue(REDRAWVIEW3D, 0);
                }
@@@ -4919,23 -4929,30 +4944,30 @@@ static void editing_panel_links(Object 
        if(ob->totcol) min= 1.0; else min= 0.0;
        ma= give_current_material(ob, ob->actcol);
  
-       if(ma) uiDefBut(block, LABEL, 0, ma->id.name+2, 318,153, 103, 20, 0, 0, 0, 0, 0, "");
+       if(G.obedit) {
+               char *str= NULL;
+               IDnames_to_pupstring(&str, NULL, "ADD NEW %x 32767", &G.main->mat, NULL, NULL);
+               uiDefButS(block, MENU, B_MATASS_BROWSE, str, 292,150,20,20, &G.buts->menunr, 0, 0, 0, 0, "Browses existing choices and assign");
+               MEM_freeN(str);
+       }
+       
+       if(ma) uiDefBut(block, LABEL, 0, ma->id.name+2, 318,150, 103, 20, 0, 0, 0, 0, 0, "");
  
        uiBlockBeginAlign(block);
-       if(ma) uiDefButF(block, COL, B_REDR, "",                        292,123,31,30, &(ma->r), 0, 0, 0, 0, "");
-       uiDefButC(block, NUM, B_ACTCOL, str,            324,123,100,30, &ob->actcol, min, (float)(ob->totcol), 0, 0, "Displays total number of material indices and the current index");
-       uiDefBut(block, BUT,B_MATWICH,  "?",            424,123,30,30, 0, 0, 0, 0, 0, "In EditMode, sets the active material index from selected faces");
+       if(ma) uiDefButF(block, COL, B_MATCOL2, "",     292,113,31,30, &(ma->r), 0, 0, 0, 0, "");
+       uiDefButC(block, NUM, B_ACTCOL, str,            324,113,100,30, &ob->actcol, min, (float)(ob->totcol), 0, 0, "Displays total number of material indices and the current index");
+       uiDefBut(block, BUT,B_MATWICH,  "?",            424,113,30,30, 0, 0, 0, 0, 0, "In EditMode, sets the active material index from selected faces");
  
        uiBlockBeginAlign(block);
-       uiDefBut(block, BUT,B_MATNEW,   "New",          292,98,80,20, 0, 0, 0, 0, 0, "Adds a new Material index");
-       uiDefBut(block, BUT,B_MATDEL,   "Delete",       374,98,80,20, 0, 0, 0, 0, 0, "Deletes this Material index");
-       uiDefBut(block, BUT,B_MATSEL,   "Select",       292,76,80,20, 0, 0, 0, 0, 0, "In EditMode, selects faces that have the active index");
-       uiDefBut(block, BUT,B_MATDESEL, "Deselect",     374,76,80,20, 0, 0, 0, 0, 0, "Deselects everything with current indexnumber");
-       uiDefBut(block, BUT,B_MATASS,   "Assign",       292,47,162,26, 0, 0, 0, 0, 0, "In EditMode, assigns the active index to selected faces");
+       uiDefBut(block, BUT,B_MATNEW,   "New",          292,90,80,20, 0, 0, 0, 0, 0, "Adds a new Material index");
+       uiDefBut(block, BUT,B_MATDEL,   "Delete",       372,90,80,20, 0, 0, 0, 0, 0, "Deletes this Material index");
+       uiDefBut(block, BUT,B_MATSEL,   "Select",       292,70,80,20, 0, 0, 0, 0, 0, "In EditMode, selects faces that have the active index");
+       uiDefBut(block, BUT,B_MATDESEL, "Deselect",     372,70,80,20, 0, 0, 0, 0, 0, "Deselects everything with current indexnumber");
+       uiDefBut(block, BUT,B_MATASS,   "Assign",       292,50,160,20, 0, 0, 0, 0, 0, "In EditMode, assigns the active index to selected faces");
  
        uiBlockBeginAlign(block);
-       uiDefBut(block, BUT,B_SETSMOOTH,"Set Smooth",   291,15,80,20, 0, 0, 0, 0, 0, "In EditMode, sets 'smooth' rendering of selected faces");
-       uiDefBut(block, BUT,B_SETSOLID, "Set Solid",    373,15,80,20, 0, 0, 0, 0, 0, "In EditMode, sets 'solid' rendering of selected faces");
+       uiDefBut(block, BUT,B_SETSMOOTH,"Set Smooth",   292,15,80,20, 0, 0, 0, 0, 0, "In EditMode, sets 'smooth' rendering of selected faces");
+       uiDefBut(block, BUT,B_SETSOLID, "Set Solid",    372,15,80,20, 0, 0, 0, 0, 0, "In EditMode, sets 'solid' rendering of selected faces");
  
        uiBlockEndAlign(block);
  
index 1808618d7b73925a7cee307e71ebe92b6a5919cb,b5733a89a0ed458b599ed0d69624f6dcf29c10ac..e7a2a654ba1f9e21bf719294d2ce068819e72eea
@@@ -47,8 -47,6 +47,8 @@@
  #include "DNA_scene_types.h"
  
  #include "BKE_action.h"
 +#include "BKE_cloth.h"
 +#include "BKE_collisions.h"
  #include "BKE_global.h"
  #include "BKE_main.h"
  #include "BKE_library.h"
@@@ -91,7 -89,6 +91,7 @@@
  #include "DNA_action_types.h"
  #include "DNA_armature_types.h"
  #include "DNA_camera_types.h"
 +#include "DNA_cloth_types.h"
  #include "DNA_constraint_types.h"
  #include "DNA_curve_types.h"
  #include "DNA_effect_types.h"
@@@ -208,7 -205,7 +208,7 @@@ static void add_constraint_to_active(Ob
  
  /* returns base ID for Ipo, sets actname to channel if appropriate */
  /* should not make action... */
- void get_constraint_ipo_context(void *ob_v, char *actname)
static void get_constraint_ipo_context(void *ob_v, char *actname)
  {
        Object *ob= ob_v;
        
@@@ -240,8 -237,11 +240,11 @@@ static void enable_constraint_ipo_func 
        get_constraint_ipo_context(ob, actname);
        
        /* adds ipo & channels & curve if needed */
-       verify_ipo((ID *)ob, ID_CO, actname, con->name);
-       
+       if(con->flag & CONSTRAINT_OWN_IPO)
+               verify_ipo((ID *)ob, ID_CO, NULL, con->name, actname);
+       else
+               verify_ipo((ID *)ob, ID_CO, actname, con->name, NULL);
+               
        /* make sure ipowin shows it */
        ob->ipowin= ID_CO;
        allqueue(REDRAWIPO, ID_CO);
@@@ -264,8 -264,11 +267,11 @@@ static void add_influence_key_to_constr
        get_constraint_ipo_context(ob, actname);
  
        /* adds ipo & channels & curve if needed */
-       icu= verify_ipocurve((ID *)ob, ID_CO, actname, con->name, CO_ENFORCE);
-       
+       if(con->flag & CONSTRAINT_OWN_IPO)
+               icu= verify_ipocurve((ID *)ob, ID_CO, NULL, con->name, actname, CO_ENFORCE);
+       else
+               icu= verify_ipocurve((ID *)ob, ID_CO, actname, con->name, NULL, CO_ENFORCE);
+               
        if (!icu) {
                error("Cannot get a curve from this IPO, may be dealing with linked data");
                return;
@@@ -2321,7 -2324,7 +2327,7 @@@ static void object_panel_object(Object 
        block= uiNewBlock(&curarea->uiblocks, "object_panel_object", UI_EMBOSS, UI_HELV, curarea->win);
        if(uiNewPanel(curarea, block, "Object and Links", "Object", 0, 0, 318, 204)==0) return;
        
-       uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
+       uiSetButLock(object_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
        
        /* object name */
        uiBlockSetCol(block, TH_BUT_SETTING2);
@@@ -2388,7 -2391,7 +2394,7 @@@ static void object_panel_anim(Object *o
        block= uiNewBlock(&curarea->uiblocks, "object_panel_anim", UI_EMBOSS, UI_HELV, curarea->win);
        if(uiNewPanel(curarea, block, "Anim settings", "Object", 320, 0, 318, 204)==0) return;
        
-       uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
+       uiSetButLock(object_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
        
        uiBlockBeginAlign(block);
        uiDefButS(block, ROW,B_TRACKBUTS,"TrackX",      24,180,59,19, &ob->trackflag, 12.0, 0.0, 0, 0, "Specify the axis that points to another object");
@@@ -2453,7 -2456,7 +2459,7 @@@ static void object_panel_draw(Object *o
        block= uiNewBlock(&curarea->uiblocks, "object_panel_draw", UI_EMBOSS, UI_HELV, curarea->win);
        if(uiNewPanel(curarea, block, "Draw", "Object", 640, 0, 318, 204)==0) return;
        
-       uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
+       uiSetButLock(object_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
        
        /* LAYERS */
        xco= 120;
@@@ -2515,7 -2518,7 +2521,7 @@@ void object_panel_constraint(char *cont
        block= uiNewBlock(&curarea->uiblocks, "object_panel_constraint", UI_EMBOSS, UI_HELV, curarea->win);
        if(uiNewPanel(curarea, block, "Constraints", context, 960, 0, 318, 204)==0) return;
        
-       uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
+       uiSetButLock(object_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
        
        /* this is a variable height panel, newpanel doesnt force new size on existing panels */
        /* so first we make it default height */
@@@ -2967,30 -2970,6 +2973,30 @@@ void do_effects_panels(unsigned short e
                }
                allqueue(REDRAWVIEW3D, 0);
                break;
 +      case B_CLOTH_CLEARCACHEALL:
 +              {
 +                      ClothModifierData *clmd = (ClothModifierData *)modifiers_findByType(ob, eModifierType_Cloth);
 +                      if(clmd)
 +                      {
 +                              CFRA= 1;
 +                              update_for_newframe_muted();
 +                              DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA); 
 +                              cloth_clear_cache(ob, clmd, 2); 
 +                              allqueue(REDRAWBUTSOBJECT, 0);
 +                              allqueue(REDRAWVIEW3D, 0);
 +                      }       
 +              }
 +              break;  
 +      case B_CLOTH_RENEW:
 +              {
 +                      ClothModifierData *clmd = (ClothModifierData *)modifiers_findByType(ob, eModifierType_Cloth);
 +                      if(clmd)
 +                      {
 +                              do_object_panels(B_CLOTH_CLEARCACHEALL);
 +                              cloth_free_modifier (clmd);
 +                      }
 +              }
 +              break;
        default:
                if(event>=B_SELEFFECT && event<B_SELEFFECT+MAX_EFFECT) {
                        ob= OBACT;
@@@ -3027,31 -3006,10 +3033,31 @@@ static void field_testTexture(char *nam
        }
        *idpp = 0;
  }
 +
 +/* Panel for collision */
 +static void object_collision__enabletoggle ( void *ob_v, void *arg2 )
 +{
 +      Object *ob = ob_v;
 +      ModifierData *md = modifiers_findByType ( ob, eModifierType_Collision );
 +
 +      if ( !md )
 +      {
 +              md = modifier_new ( eModifierType_Collision );
 +              BLI_addhead ( &ob->modifiers, md );
 +      }
 +      else
 +      {
 +              BLI_remlink ( &ob->modifiers, md );
 +              modifier_free ( md );
 +              allqueue(REDRAWBUTSEDIT, 0);
 +      }
 +}
 +
  /* Panels for particle interaction settings */
  static void object_panel_deflection(Object *ob)
  {
        uiBlock *block;
 +      uiBut *but;
  
        block= uiNewBlock(&curarea->uiblocks, "object_panel_deflection", UI_EMBOSS, UI_HELV, curarea->win);
        if(uiNewPanel(curarea, block, "Deflection", "Physics", 0, 0, 318, 204)==0) return;
        if(ob->pd && ob->type==OB_MESH) {
                PartDeflect *pd= ob->pd;
                
 -              uiDefButBitS(block, TOG, 1, B_REDR, "Deflection",160,160,150,20, &pd->deflect, 0, 0, 0, 0, "Deflects particles based on collision");
 +              but = uiDefButBitS(block, TOG, 1, B_REDR, "Deflection",160,160,150,20, &pd->deflect, 0, 0, 0, 0, "Deflects particles based on collision");
 +              uiButSetFunc(but, object_collision__enabletoggle, ob, NULL);
 +              
                if(pd->deflect) {
                        uiDefBut(block, LABEL, 0, "Particles",                  160,140,75,20, NULL, 0.0, 0, 0, 0, "");
                        uiDefButBitS(block, TOG, PDEFLE_KILL_PART, B_DIFF, "Kill",235,140,75,20, &pd->flag, 0, 0, 0, 0, "Kill collided particles");
@@@ -4668,233 -4624,6 +4674,233 @@@ errMessage
  #endif // DISABLE_ELBEEM
  }
  
 +/* Panel for cloth */
 +static void object_cloth__enabletoggle(void *ob_v, void *arg2)
 +{
 +      Object *ob = ob_v;
 +      ModifierData *md = modifiers_findByType(ob, eModifierType_Cloth);
 +
 +      if (!md) {
 +              md = modifier_new(eModifierType_Cloth);
 +              BLI_addhead(&ob->modifiers, md);
 +      }
 +      else {
 +              BLI_remlink(&ob->modifiers, md);
 +              modifier_free(md);
 +      }
 +
 +      allqueue(REDRAWBUTSEDIT, 0);
 +}
 +
 +static void object_panel_cloth(Object *ob)
 +{
 +      uiBlock *block;
 +      static int val, val2;
 +      uiBut *but;
 +      ClothModifierData *clmd = (ClothModifierData *)modifiers_findByType(ob, eModifierType_Cloth);
 +      block= uiNewBlock(&curarea->uiblocks, "object_panel_cloth", UI_EMBOSS, UI_HELV, curarea->win);
 +      if(uiNewPanel(curarea, block, "Cloth", "Physics", 640, 0, 318, 204)==0) return;
 +
 +      if(ob->id.lib) uiSetButLock(1, "Can't edit library data");
 +      val = ((clmd)?(1):(0));
 +
 +      but = uiDefButI(block, TOG, REDRAWBUTSOBJECT, "Cloth Object",   10,200,130,20, &val, 0, 0, 0, 0, "Sets object to become cloth");
 +      uiButSetFunc(but, object_cloth__enabletoggle, ob, NULL);
 +      uiDefBut(block, LABEL, 0, "",10,10,300,0, NULL, 0.0, 0, 0, 0, ""); /* tell UI we go to 10,10*/
 +      
 +      if(clmd)
 +      {
 +              // but = uiDefButBitI(block, TOG, CLOTH_SIMSETTINGS_FLAG_COLLOBJ, B_EFFECT_DEP, "Collision Object",     170,200,130,20, &clmd->sim_parms->flags, 0, 0, 0, 0, "Sets object to become a cloth collision object");
 +
 +              if (!(clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_COLLOBJ))
 +              {
 +                      Cloth *cloth = clmd->clothObject;
 +                      int defCount;
 +                      char *clvg1, *clvg2;
 +                      char clmvg [] = "Mass Vertex Group%t|None%x0|";
 +      
 +                      val2=0;
 +      
 +      //              uiDefButBitI(block, TOG, CSIMSETT_FLAG_ADVANCED, REDRAWBUTSOBJECT, "Advanced",  180,200,130,20, &clmd->sim_parms->flags, 0, 0, 0, 0, "Enable advanced mode");
 +                      
 +                      /* GENERAL STUFF */
 +                      uiClearButLock();
 +                      uiBlockBeginAlign(block);
 +                      uiDefButF(block, NUM, B_CLOTH_RENEW, "StructStiff:",       10,170,150,20, &clmd->sim_parms->structural, 1.0, 10000.0, 100, 0, "Overall stiffness of structure");
 +                      uiDefButF(block, NUM, B_CLOTH_RENEW, "BendStiff:",         160,170,150,20, &clmd->sim_parms->bending, 0.0, 10000.0, 1000, 0, "Wrinkle possibility");
 +                      uiDefButI(block, NUM, B_CLOTH_RENEW, "Quality:",  10,150,150,20, &clmd->sim_parms->stepsPerFrame, 3.0, 10.0, 5, 0, "Quality of the simulation (higher=>better=>slower)");
 +                      uiBlockEndAlign(block);
 +                      uiBlockBeginAlign(block);
 +                      uiDefButF(block, NUM, B_CLOTH_RENEW, "Spring Damp:",       160,150,150,20, &clmd->sim_parms->Cdis, 0.0, 10.0, 10, 0, "Spring damping");
 +                      uiDefButF(block, NUM, B_DIFF, "Air Damp:",         10,130,150,20, &clmd->sim_parms->Cvi, 0.0, 10.0, 10, 0, "Apply gravitation to point movement");
 +                      uiBlockEndAlign(block);                 
 +                      
 +                      uiClearButLock();
 +                      
 +                      uiBlockBeginAlign(block);
 +                      uiDefBut(block, LABEL, 0, "Gravity:",  10,100,60,20, NULL, 0.0, 0, 0, 0, "");
 +                      // uiClearButLock();
 +                      
 +                      uiDefButF(block, NUM, B_CLOTH_RENEW, "X:",         70,100,80,20, &clmd->sim_parms->gravity[0], -100.0, 100.0, 10, 0, "Apply gravitation to point movement");
 +                      uiDefButF(block, NUM, B_CLOTH_RENEW, "Y:",         150,100,80,20, &clmd->sim_parms->gravity[1], -100.0, 100.0, 10, 0, "Apply gravitation to point movement");
 +                      uiDefButF(block, NUM, B_CLOTH_RENEW, "Z:",         230,100,80,20, &clmd->sim_parms->gravity[2], -100.0, 100.0, 10, 0, "Apply gravitation to point movement");
 +                      uiBlockEndAlign(block);
 +                      
 +                      /* GOAL STUFF */
 +                      uiBlockBeginAlign(block);
 +                      uiDefButBitI(block, TOG, CLOTH_SIMSETTINGS_FLAG_GOAL, REDRAWVIEW3D, "Use Goal", 10,70,130,20, &clmd->sim_parms->flags, 0, 0, 0, 0, "Define forces for vertices to stick to animated position");
 +                      if (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL)
 +                      {
 +                              if(ob->type==OB_MESH) 
 +                              {
 +                                      
 +                                      defCount = sizeof (clmvg);
 +                                      clvg1 = get_vertexgroup_menustr (ob);
 +                                      clvg2 = MEM_callocN (strlen (clvg1) + 1 + defCount, "clothVgMS");
 +                                      if (! clvg2) {
 +                                              printf ("draw_modifier: error allocating memory for cloth vertex group menu string.\n");
 +                                              return;
 +                                      }
 +                                      defCount = BLI_countlist (&ob->defbase);
 +                                      if (defCount == 0) 
 +                                      {
 +                                              clmd->sim_parms->vgroup_mass = 0;
 +                                      }
 +                                      sprintf (clvg2, "%s%s", clmvg, clvg1);
 +                                      
 +                                      uiDefButS(block, MENU, B_CLOTH_RENEW, clvg2,    140,70,20,20, &clmd->sim_parms->vgroup_mass, 0, defCount, 0, 0, "Browses available vertex groups");     
 +                                      MEM_freeN (clvg1);
 +                                      MEM_freeN (clvg2);
 +                                      
 +                                      if(clmd->sim_parms->vgroup_mass) 
 +                                      {
 +                                              bDeformGroup *defGroup = BLI_findlink(&ob->defbase, clmd->sim_parms->vgroup_mass-1);
 +                                              if(defGroup)
 +                                                      uiDefBut(block, BUT, B_DIFF, defGroup->name,    160,70,130,20, NULL, 0.0, 0.0, 0, 0, "Name of current vertex group");
 +                                              else
 +                                                      uiDefBut(block, BUT, B_DIFF, "(no group)",      160,70,130,20, NULL, 0.0, 0.0, 0, 0, "Vertex Group doesn't exist anymore");
 +                                              
 +                                              uiDefIconBut(block, BUT, B_CLOTH_DEL_VG, ICON_X, 290,70,20,20, 0, 0, 0, 0, 0, "Disable use of vertex group");
 +                                              
 +                                      }
 +                                      else
 +                                              uiDefButF(block, NUM, B_CLOTH_RENEW, "Goal:",   160,70,150,20, &clmd->sim_parms->defgoal, 0.0, 1.0, 10, 0, "Default Goal (vertex target position) value, when no Vertex Group used");
 +                              
 +                              }
 +                              else 
 +                              {
 +                                      uiDefButS(block, TOG, B_CLOTH_RENEW, "W",                       140,70,20,20, &clmd->sim_parms->vgroup_mass, 0, 1, 0, 0, "Use control point weight values");
 +                                      uiDefButF(block, NUM, B_CLOTH_RENEW, "Goal:",   160,70,150,20, &clmd->sim_parms->defgoal, 0.0, 1.0, 10, 0, "Default Goal (vertex target position) value, when no Vertex Group used");
 +                              }
 +                              
 +                              uiDefButF(block, NUM, B_CLOTH_RENEW, "G Stiff:",        10,50,150,20, &clmd->sim_parms->goalspring, 0.0, 500.0, 10, 0, "Goal (vertex target position) spring stiffness");
 +                              uiDefButF(block, NUM, B_CLOTH_RENEW, "G Damp:", 160,50,150,20, &clmd->sim_parms->goalfrict, 0.0, 50.0, 10, 0, "Goal (vertex target position) friction");
 +                              uiDefButF(block, NUM, B_CLOTH_RENEW, "G Min:",          10,30,150,20, &clmd->sim_parms->mingoal, 0.0, 1.0, 10, 0, "Goal minimum, vertex group weights are scaled to match this range");
 +                              uiDefButF(block, NUM, B_CLOTH_RENEW, "G Max:",          160,30,150,20, &clmd->sim_parms->maxgoal, 0.0, 1.0, 10, 0, "Goal maximum, vertex group weights are scaled to match this range");
 +                      }
 +                      uiBlockEndAlign(block); 
 +                      
 +                      /*
 +                      // no tearing supported anymore since modifier stack restrictions 
 +                      uiBlockBeginAlign(block);
 +                      uiDefButBitI(block, TOG, CSIMSETT_FLAG_TEARING_ENABLED, B_EFFECT_DEP, "Tearing",        10,0,150,20, &clmd->sim_parms->flags, 0, 0, 0, 0, "Sets object to become a cloth collision object");
 +                      
 +                      if (clmd->sim_parms->flags & CSIMSETT_FLAG_TEARING_ENABLED)
 +                      {
 +                              uiDefButI(block, NUM, B_DIFF, "Max extent:",       160,0,150,20, &clmd->sim_parms->maxspringlen, 1.0, 1000.0, 10, 0, "Maximum extension before spring gets cut");
 +                      }
 +                      
 +                      uiBlockEndAlign(block); 
 +                      */
 +              }
 +      }
 +}
 +
 +
 +static void object_panel_cloth_II(Object *ob)
 +{
 +      uiBlock *block;
 +      static int val;
 +      uiBut *but;
 +      ClothModifierData *clmd = NULL;
 +      
 +      clmd = (ClothModifierData *)modifiers_findByType(ob, eModifierType_Cloth);
 +      if(clmd)
 +      {
 +              if (!(clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_COLLOBJ))
 +              {
 +                      Cloth *cloth = clmd->clothObject;
 +                      char str[128];
 +                      
 +                      block= uiNewBlock(&curarea->uiblocks, "object_panel_cloth_II", UI_EMBOSS, UI_HELV, curarea->win);
 +                      uiNewPanelTabbed("Cloth", "Physics");
 +                      if(uiNewPanel(curarea, block, "Cloth Cache", "Physics", 651, 0, 318, 204)==0) return;
 +              
 +                      uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
 +                      
 +                      uiDefButI(block, NUM, B_DIFF, "First Frame:",           10,160,150,20, &clmd->sim_parms->firstframe, 0, MAXFRAME, 1, 0, "Frame on which the simulation starts");
 +                      uiDefButI(block, NUM, B_DIFF, "Last Frame:",            160,160,150,20, &clmd->sim_parms->lastframe, 0, MAXFRAME, 10, 0, "Frame on which the simulation stops");
 +                      /*
 +                      if(clmd->sim_parms->cache)
 +                      {
 +                              int length = BLI_linklist_length(clmd->sim_parms->cache);
 +                              
 +                              // correct spelling if only 1 frame cacheed --> only gimmick  
 +                              if(length-clmd->sim_parms->preroll>1)
 +                                      sprintf (str, "Frame 1 - %d cached. [%d in preroll, %d in total]", length-clmd->sim_parms->preroll, clmd->sim_parms->preroll, length);
 +                              else
 +                                      sprintf (str, "Frame %d cached. [%d in preroll, %d in total]", length-clmd->sim_parms->preroll, clmd->sim_parms->preroll, length);
 +                              
 +                              uiDefBut(block, LABEL, 0, str,  10,140,290,20, NULL, 0.0, 0, 0, 0, "");
 +                              uiDefBut(block, LABEL, 0, "Clear cache:",  10,120,290,20, NULL, 0.0, 0, 0, 0, "");
 +                              uiBlockBeginAlign (block);
 +                              uiDefBut(block, BUT, B_CLOTH_CLEARCACHEALL, "All", 10, 100,145,20, NULL, 0.0, 0.0, 0, 0, "Free cloth cache without preroll");
 +                              uiDefBut(block, BUT, B_CLOTH_CLEARCACHEFRAME, "From next frame", 155, 100,145,20, NULL, 0.0, 0.0, 0, 0, "Free cloth cache");    
 +                              if(length>1) // B_CLOTH_CHANGEPREROLL
 +                                      uiDefButI(block, NUM, B_CLOTH_CHANGEPREROLL, "Preroll:", 10,80,145,20, &clmd->sim_parms->preroll, 0, length-1, 1, 0, "Simulation starts on this frame");        
 +                              else
 +                                      uiDefBut(block, LABEL, 0, " ",  10,80,145,20, NULL, 0.0, 0, 0, 0, "");
 +                      }
 +                      else 
 +                      {
 +                              uiDefBut(block, LABEL, 0, "No frames cached.",  10,120,290,20, NULL, 0.0, 0, 0, 0, "");
 +                      }*/
 +                      uiDefButBitI(block, TOG, CLOTH_SIMSETTINGS_FLAG_CCACHE_PROTECT, REDRAWVIEW3D, "Protect Cache",  10,50,145,20, &clmd->sim_parms->flags, 0, 0, 0, 0, "Protect cache from automatic freeing when scene changed");
 +                      uiBlockEndAlign(block);
 +              }
 +      }
 +      // uiBlockEndAlign(block);
 +}
 +
 +static void object_panel_cloth_III(Object *ob)
 +{
 +      uiBlock *block;
 +      ClothModifierData *clmd = NULL;
 +      
 +      clmd = (ClothModifierData *)modifiers_findByType(ob, eModifierType_Cloth);
 +      if(clmd)
 +      {       
 +              block= uiNewBlock(&curarea->uiblocks, "object_panel_cloth_III", UI_EMBOSS, UI_HELV, curarea->win);
 +              uiNewPanelTabbed("Cloth", "Physics");
 +              if(uiNewPanel(curarea, block, "Cloth Collisions", "Physics", 651, 0, 318, 204)==0) return;
 +      
 +              uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
 +              
 +              uiBlockBeginAlign(block);
 +              uiDefButBitI(block, TOG, CLOTH_COLLISIONSETTINGS_FLAG_ENABLED, REDRAWVIEW3D, "Enable collisions",       10,160,130,20, &clmd->coll_parms->flags, 0, 0, 0, 0, "Enable collisions with this object");
 +              if (clmd->coll_parms->flags & CLOTH_COLLISIONSETTINGS_FLAG_ENABLED)
 +              {
 +                      // uiDefBut(block, LABEL, 0, "",10,10,300,20, NULL, 0.0, 0, 0, 0, ""); /* tell UI we go to 10,10*/
 +                      uiDefButF(block, NUM, B_CLOTH_RENEW, "Min Distance:",      10,140,150,20, &clmd->coll_parms->epsilon, 0.001f, 1.0, 0.01f, 0, "Minimum distance between collision objects before collision response takes in");
 +                      uiDefBut(block, LABEL, 0, "",160,140,150,20, NULL, 0.0, 0, 0, 0, "");
 +                      uiDefButF(block, NUM, B_CLOTH_RENEW, "Selfcoll balls:",    10,120,150,20, &clmd->coll_parms->selfepsilon, 0.001f, 1.0, 0.49f, 0, "Minimum distance between two selfcollision points");
 +              }
 +              else
 +                      uiDefBut(block, LABEL, 0, "",140,10,170,20, NULL, 0.0, 0, 0, 0, "");
 +              uiBlockEndAlign(block);
 +      }
 +}
 +
  void object_panels()
  {
        Object *ob;
@@@ -4923,9 -4652,6 +4929,9 @@@ void physics_panels(
                object_panel_fields(ob);
                object_softbodies(ob);
                object_softbodies_II(ob);
 +              object_panel_cloth(ob);
 +              object_panel_cloth_II(ob);
 +              object_panel_cloth_III(ob);
                object_panel_fluidsim(ob);
        }
  }
index c904bb2794761f11193b5923624699b47de355d6,8f40742852ee41483784e0f04320fd89b005099f..597e15154998b58d3992a6fee6beaf035ac9609c
  #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"
@@@ -1759,10 -1758,6 +1759,10 @@@ void exit_editmode(int flag)  /* freedat
                sbObjectToSoftbody(ob);
        }
        
 +      if(modifiers_isClothEnabled(ob)) {
 +              cloth_free_modifier(modifiers_isClothEnabled(ob));
 +      }
 +      
        if(ob->type==OB_MESH && get_mesh(ob)->mr)
                multires_edge_level_update(ob, get_mesh(ob));
        
@@@ -5489,6 -5484,18 +5489,18 @@@ void hookmenu(void
        }       
  }
  
+ /*
+  * Returns true if the Object is a from an external blend file (libdata)
+  */
+ int object_is_libdata(Object *ob)
+ {
+       if (!ob) return 0;
+       if (ob->proxy) return 0;
+       if (ob->id.lib) return 1;
+       return 0;
+ }
  /*
   * Returns true if the Object data is a from an external blend file (libdata)
   */
index 01289113bf151d380b69bf2f10c56aed1f72b692,804241ac9b98b8e4adb303d4f9ea9b703d792c44..0da76e36e22b187a31b8917d69940dfe6b6c16b3
@@@ -307,7 -307,7 +307,7 @@@ void KX_BlenderSceneConverter::ConvertS
                case UseBullet:
                        {
                                CcdPhysicsEnvironment* ccdPhysEnv = new CcdPhysicsEnvironment();
 -                              ccdPhysEnv->setDebugDrawer(new BlenderDebugDraw());
 +                              // ccdPhysEnv->setDebugDrawer(new BlenderDebugDraw());
                                ccdPhysEnv->setDeactivationLinearTreshold(0.8f); // default, can be overridden by Python
                                ccdPhysEnv->setDeactivationAngularTreshold(1.0f); // default, can be overridden by Python
  
@@@ -553,7 -553,7 +553,7 @@@ extern "C
  {
        Ipo *add_ipo( char *name, int idcode );
        char *getIpoCurveName( IpoCurve * icu );
-       struct IpoCurve *verify_ipocurve(struct ID *, short, char *, char *, int);
+       struct IpoCurve *verify_ipocurve(struct ID *, short, char *, char *, char *, int);
        void testhandles_ipocurve(struct IpoCurve *icu);
        void Mat3ToEul(float tmat[][3], float *eul);
  
@@@ -766,27 -766,27 +766,27 @@@ void    KX_BlenderSceneConverter::WritePhy
  
                                        IpoCurve *icu1 = findIpoCurve((IpoCurve *)ipo->curve.first,"LocX");
                                        if (!icu1)
-                                               icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, OB_LOC_X);
+                                               icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_LOC_X);
                                        
                                        icu1 = findIpoCurve((IpoCurve *)ipo->curve.first,"LocY");
                                        if (!icu1)
-                                               icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, OB_LOC_Y);
+                                               icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_LOC_Y);
                                        
                                        icu1 = findIpoCurve((IpoCurve *)ipo->curve.first,"LocZ");
                                        if (!icu1)
-                                               icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, OB_LOC_Z);
+                                               icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_LOC_Z);
  
                                        icu1 = findIpoCurve((IpoCurve *)ipo->curve.first,"RotX");
                                        if (!icu1)
-                                               icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, OB_ROT_X);
+                                               icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_ROT_X);
  
                                        icu1 = findIpoCurve((IpoCurve *)ipo->curve.first,"RotY");
                                        if (!icu1)
-                                               icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, OB_ROT_Y);
+                                               icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_ROT_Y);
  
                                        icu1 = findIpoCurve((IpoCurve *)ipo->curve.first,"RotZ");
                                        if (!icu1)
-                                               icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, OB_ROT_Z);
+                                               icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_ROT_Z);
  
  
  
@@@ -922,27 -922,27 +922,27 @@@ void    KX_BlenderSceneConverter::TestHand
  
                                        IpoCurve *icu1 = findIpoCurve((IpoCurve *)ipo->curve.first,"LocX");
                                        if (!icu1)
-                                               icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, OB_LOC_X);
+                                               icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_LOC_X);
                                        
                                        icu1 = findIpoCurve((IpoCurve *)ipo->curve.first,"LocY");
                                        if (!icu1)
-                                               icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, OB_LOC_Y);
+                                               icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_LOC_Y);
                                        
                                        icu1 = findIpoCurve((IpoCurve *)ipo->curve.first,"LocZ");
                                        if (!icu1)
-                                               icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, OB_LOC_Z);
+                                               icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_LOC_Z);
  
                                        icu1 = findIpoCurve((IpoCurve *)ipo->curve.first,"RotX");
                                        if (!icu1)
-                                               icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, OB_ROT_X);
+                                               icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_ROT_X);
  
                                        icu1 = findIpoCurve((IpoCurve *)ipo->curve.first,"RotY");
                                        if (!icu1)
-                                               icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, OB_ROT_Y);
+                                               icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_ROT_Y);
  
                                        icu1 = findIpoCurve((IpoCurve *)ipo->curve.first,"RotZ");
                                        if (!icu1)
-                                               icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, OB_ROT_Z);
+                                               icu1 = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_ROT_Z);
  
  
  
diff --combined tools/btools.py
index 1b91a3343dcbc7dc1f9543fead7cb5cf62605bc4,455335ab89509b043c844cd9b5d1bb97a36ea858..488b434c58abed4ebc98eb2c9004a3092753a2d0
@@@ -54,10 -54,9 +54,10 @@@ def validate_arguments(args, bc)
              'BF_PROFILE_FLAGS', 'LCGDIR', 'WITH_BF_VERSE', 
              'BF_VERSE_INCLUDE',
              'VERSE_BUILD_BINARY', 'VERSE_BUILD_DIR', 'VERSE_REGEN_PROTO',
-             'BF_TWEAK_MODE',
+             'BF_TWEAK_MODE', 'BF_SPLIT_SRC',
 -            'WITHOUT_BF_INSTALL'
 -            ]
 +            'WITHOUT_BF_INSTALL',
 +            'WITH_BF_OPENMP'
 +          ]
  
      arg_list = ['BF_DEBUG', 'BF_QUIET', 'BF_CROSS', 'BF_UPDATE',
              'BF_INSTALLDIR', 'BF_TOOLSET', 'BF_BINNAME',
@@@ -248,8 -247,6 +248,8 @@@ def read_opts(cfg, args)
          ('BF_FREETYPE_LIB', 'Freetype library', ''),
          ('BF_FREETYPE_LIBPATH', 'Freetype library path', ''),
  
 +      (BoolOption('WITH_BF_OPENMP', 'Use OpenMP if true', 'false')),
 +
          (BoolOption('WITH_BF_QUICKTIME', 'Use QuickTime if true', 'false')),
          ('BF_QUICKTIME', 'QuickTime base path', ''),
          ('BF_QUICKTIME_INC', 'QuickTime include path', ''),
          (BoolOption('BF_BUILDINFO', 'Buildtime in splash if true', 'true')),
  
          (BoolOption('BF_TWEAK_MODE', 'Enable tweak mode if true', 'false')),
+               (BoolOption('BF_SPLIT_SRC', 'Split src lib into several chunks if true', 'false')),
          (BoolOption('WITHOUT_BF_INSTALL', 'dont install if true', 'false')),
  
      ) # end of opts.AddOptions()