diff options
author | Daniel Genrich <daniel.genrich@gmx.net> | 2008-01-25 19:14:54 +0300 |
---|---|---|
committer | Daniel Genrich <daniel.genrich@gmx.net> | 2008-01-25 19:14:54 +0300 |
commit | a01a606b1fdc2f855d84f855033116cc2ff5191d (patch) | |
tree | 47c396984e6990a548a62efb5550e0b2ea95725d /source | |
parent | 589870100dc6734a20c99f572baeb2c401e6509f (diff) |
Weekend commit -> New: 3rd tab for advanced users mit many things to play with. Fixed: Free modifier correctly when deactivating cloth on panel, be carefull: could eventually put weird values on the GUI due to changed DNA
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_cloth.h | 7 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/cloth.c | 88 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/collision.c | 5 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/implicit.c | 13 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_cloth_types.h | 20 | ||||
-rw-r--r-- | source/blender/src/buttons_object.c | 136 | ||||
-rw-r--r-- | source/blender/src/vpaint.c | 1 |
7 files changed, 213 insertions, 57 deletions
diff --git a/source/blender/blenkernel/BKE_cloth.h b/source/blender/blenkernel/BKE_cloth.h index 3a3d6612a23..5bcd40c5905 100644 --- a/source/blender/blenkernel/BKE_cloth.h +++ b/source/blender/blenkernel/BKE_cloth.h @@ -80,7 +80,10 @@ typedef struct ClothVertex float goal; /* goal, from SB */ float impulse[3]; /* used in collision.c */ unsigned int impulse_count; /* same as above */ - float avg_spring_len; /* average length of connected springs, UNUSED ATM */ + float avg_spring_len; /* average length of connected springs, UNUSED ATM */ + float struct_stiff; + float bend_stiff; + float shear_stiff; } ClothVertex; @@ -99,6 +102,7 @@ typedef struct ClothSpring float dfdx[3][3]; float dfdv[3][3]; float f[3]; + float stiffness; /* stiffness factor from the vertex groups */ } ClothSpring; @@ -135,6 +139,7 @@ typedef enum CLOTH_SIMSETTINGS_FLAG_CCACHE_PROTECT = ( 1 << 5 ), // true if tearing is enabled CLOTH_SIMSETTINGS_FLAG_NEW = ( 1 << 6 ), // unsued, true if cloth was just enabled CLOTH_SIMSETTINGS_FLAG_CCACHE_FFREE = (1 << 7), /* force cache freeing */ + CLOTH_SIMSETTINGS_FLAG_SCALING = (1 << 8), /* is advanced scaling active? */ } CLOTH_SIMSETTINGS_FLAGS; /* COLLISION FLAGS */ diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index e1b97362e08..8ffb7ef2d19 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -125,7 +125,7 @@ static void cloth_to_object (Object *ob, ClothModifierData *clmd, DerivedMesh * static void cloth_from_mesh ( Object *ob, ClothModifierData *clmd, DerivedMesh *dm ); static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *dm, float framenr); int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm ); -static void cloth_apply_vgroup ( ClothModifierData *clmd, DerivedMesh *dm, short vgroup ); +static void cloth_apply_vgroup ( ClothModifierData *clmd, DerivedMesh *dm, short vgroup, int mode ); /****************************************************************************** @@ -162,10 +162,11 @@ void cloth_init ( ClothModifierData *clmd ) clmd->sim_parms->vgroup_mass = 0; clmd->sim_parms->lastcachedframe = 0; clmd->sim_parms->editedframe = 0; + clmd->sim_parms->autoprotect = 10; clmd->coll_parms->self_friction = 5.0; clmd->coll_parms->friction = 10.0; - clmd->coll_parms->loop_count = 1; + clmd->coll_parms->loop_count = 5; clmd->coll_parms->epsilon = 0.01f; clmd->coll_parms->flags = CLOTH_COLLSETTINGS_FLAG_ENABLED; @@ -482,8 +483,6 @@ DerivedMesh *CDDM_create_tearing ( ClothModifierData *clmd, DerivedMesh *dm ) return result; } - - int modifiers_indexInObject(Object *ob, ModifierData *md_seek); int cloth_read_cache(Object *ob, ClothModifierData *clmd, float framenr) @@ -522,10 +521,10 @@ int cloth_read_cache(Object *ob, ClothModifierData *clmd, float framenr) } fclose(fp); - - if(clmd->sim_parms->solver_type == 0) - implicit_set_positions(clmd); } + + if(clmd->sim_parms->solver_type == 0) + implicit_set_positions(clmd); return ret; } @@ -655,6 +654,14 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd,Object *ob, DerivedMesh *d { cloth_free_modifier (ob, clmd); } + + // sanity check for correctness of GUI values + if(clmd->sim_parms->max_struct<clmd->sim_parms->structural) + clmd->sim_parms->max_struct=clmd->sim_parms->structural; + if(clmd->sim_parms->max_bend<clmd->sim_parms->bending) + clmd->sim_parms->max_struct=clmd->sim_parms->bending; + if(clmd->sim_parms->max_shear<clmd->sim_parms->shear) + clmd->sim_parms->max_shear=clmd->sim_parms->shear; if ( deltaTime == 1.0f ) { @@ -693,7 +700,7 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd,Object *ob, DerivedMesh *d VECCOPY ( verts->xconst, mvert[i].co ); Mat4MulVecfl ( ob->obmat, verts->xconst ); } - + tstart(); // Call the solver. @@ -704,6 +711,10 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd,Object *ob, DerivedMesh *d // printf ( "Cloth simulation time: %f\n", ( float ) tval() ); cloth_write_cache(ob, clmd, framenr); + + // check for autoprotection + if(framenr >= clmd->sim_parms->autoprotect) + clmd->sim_parms->flags |= CLOTH_SIMSETTINGS_FLAG_CCACHE_PROTECT; } // Copy the result back to the object. @@ -897,7 +908,8 @@ static void cloth_to_object (Object *ob, ClothModifierData *clmd, DerivedMesh * * cloth_apply_vgroup - applies a vertex group as specified by type * **/ -static void cloth_apply_vgroup ( ClothModifierData *clmd, DerivedMesh *dm, short vgroup ) +/* can be optimized to do all groups in one loop */ +static void cloth_apply_vgroup ( ClothModifierData *clmd, DerivedMesh *dm, short vgroup, int mode ) { unsigned int i = 0; unsigned int j = 0; @@ -922,7 +934,7 @@ static void cloth_apply_vgroup ( ClothModifierData *clmd, DerivedMesh *dm, short for ( i = 0; i < numverts; i++, verts++ ) { // LATER ON, support also mass painting here - if ( clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL ) + if ((clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL )||(clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_SCALING)) { dvert = dm->getVertData ( dm, i, CD_MDEFORMVERT ); if ( dvert ) @@ -931,25 +943,37 @@ static void cloth_apply_vgroup ( ClothModifierData *clmd, DerivedMesh *dm, short { if ( dvert->dw[j].def_nr == vgroup ) { - verts->goal = dvert->dw [j].weight; - - goalfac= 1.0f; - - /* - // Kicking goal factor to simplify things...who uses that anyway? - // ABS ( clmd->sim_parms->maxgoal - clmd->sim_parms->mingoal ); - */ + if (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL ) + { + verts->goal = dvert->dw [j].weight; + goalfac= 1.0f; + + /* + // Kicking goal factor to simplify things...who uses that anyway? + // ABS ( clmd->sim_parms->maxgoal - clmd->sim_parms->mingoal ); + */ + + verts->goal = ( float ) pow ( verts->goal , 4.0f ); + if ( verts->goal >=SOFTGOALSNAP ) + verts->flags |= CLOTH_VERT_FLAG_PINNED; + + break; + } - verts->goal = ( float ) pow ( verts->goal , 4.0f ); - - if ( verts->goal >=SOFTGOALSNAP ) + if (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_SCALING ) { - verts->flags |= CLOTH_VERT_FLAG_PINNED; + if(mode==2) + { + verts->struct_stiff = dvert->dw [j].weight; + verts->shear_stiff = dvert->dw [j].weight; + } + else if(mode==1) + { + verts->bend_stiff = dvert->dw [j].weight; + } + break; } - // TODO enable mass painting here, for the moment i let "goals" go first - - break; } } } @@ -1044,7 +1068,15 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d // apply / set vertex groups if ( clmd->sim_parms->vgroup_mass > 0 ) - cloth_apply_vgroup ( clmd, dm, clmd->sim_parms->vgroup_mass ); + cloth_apply_vgroup ( clmd, dm, clmd->sim_parms->vgroup_mass, 0 ); + + // apply / set vertex groups + if ( clmd->sim_parms->vgroup_bend > 0 ) + cloth_apply_vgroup ( clmd, dm, clmd->sim_parms->vgroup_bend, 1 ); + + // apply / set vertex groups + if ( clmd->sim_parms->vgroup_struct > 0 ) + cloth_apply_vgroup ( clmd, dm, clmd->sim_parms->vgroup_struct, 2 ); // init our solver if ( solvers [clmd->sim_parms->solver_type].init ) @@ -1181,6 +1213,7 @@ int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm ) clmd->coll_parms->avg_spring_len += spring->restlen; spring->type = CLOTH_SPRING_TYPE_STRUCTURAL; spring->flags = 0; + spring->stiffness = (cloth->verts[spring->kl].struct_stiff + cloth->verts[spring->ij].struct_stiff) / 2.0; struct_springs++; if(!i) @@ -1203,6 +1236,7 @@ int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm ) VECSUB ( temp, cloth->verts[spring->kl].x, cloth->verts[spring->ij].x ); spring->restlen = sqrt ( INPR ( temp, temp ) ); spring->type = CLOTH_SPRING_TYPE_SHEAR; + spring->stiffness = (cloth->verts[spring->kl].shear_stiff + cloth->verts[spring->ij].shear_stiff) / 2.0; BLI_linklist_append ( &edgelist[spring->ij], spring ); BLI_linklist_append ( &edgelist[spring->kl], spring ); @@ -1220,6 +1254,7 @@ int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm ) VECSUB ( temp, cloth->verts[spring->kl].x, cloth->verts[spring->ij].x ); spring->restlen = sqrt ( INPR ( temp, temp ) ); spring->type = CLOTH_SPRING_TYPE_SHEAR; + spring->stiffness = (cloth->verts[spring->kl].shear_stiff + cloth->verts[spring->ij].shear_stiff) / 2.0; BLI_linklist_append ( &edgelist[spring->ij], spring ); BLI_linklist_append ( &edgelist[spring->kl], spring ); @@ -1257,6 +1292,7 @@ int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm ) VECSUB ( temp, cloth->verts[index2].x, cloth->verts[tspring2->ij].x ); spring->restlen = sqrt ( INPR ( temp, temp ) ); spring->type = CLOTH_SPRING_TYPE_BENDING; + spring->stiffness = (cloth->verts[spring->kl].bend_stiff + cloth->verts[spring->ij].bend_stiff) / 2.0; BLI_edgehash_insert ( edgehash, spring->ij, index2, NULL ); bend_springs++; diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c index 3d967655f70..1ce19e878fa 100644 --- a/source/blender/blenkernel/intern/collision.c +++ b/source/blender/blenkernel/intern/collision.c @@ -978,9 +978,6 @@ void cloth_collision_moving(ClothModifierData *clmd, ClothModifierData *coll_clm cloth_collision_moving_tris(coll_clmd, clmd, tree2, tree1); } -// CLOTH_MAX_THRESHOLD defines how much collision rounds/loops should be taken -#define CLOTH_MAX_THRESHOLD 10 - // cloth - object collisions int cloth_bvh_objcollision(ClothModifierData * clmd, float step, float dt) { @@ -1092,7 +1089,7 @@ int cloth_bvh_objcollision(ClothModifierData * clmd, float step, float dt) } rounds++; } - while(result && (CLOTH_MAX_THRESHOLD>rounds)); + while(result && (clmd->coll_parms->loop_count>rounds)); //////////////////////////////////////////////////////////// // update positions diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c index 557a664b5ea..7ea48d6629b 100644 --- a/source/blender/blenkernel/intern/implicit.c +++ b/source/blender/blenkernel/intern/implicit.c @@ -1091,6 +1091,8 @@ DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s, float damping_force[3] = {0,0,0}; float nulldfdx[3][3]={ {0,0,0}, {0,0,0}, {0,0,0}}; + float scaling = 0.0; + VECCOPY(s->f, nullf); cp_fmatrix(s->dfdx, nulldfdx); cp_fmatrix(s->dfdv, nulldfdx); @@ -1122,15 +1124,17 @@ DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s, mul_fvector_S(dir, extent, 0.0f); } - // calculate force of structural + shear springs if(s->type != CLOTH_SPRING_TYPE_BENDING) { if(length > L) // only on elonglation { s->flags |= CLOTH_SPRING_FLAG_NEEDED; - - k = clmd->sim_parms->structural; + + k = clmd->sim_parms->structural; + + scaling = k + s->stiffness * (clmd->sim_parms->max_struct-k); + k = scaling; mul_fvector_S(stretch_force, dir, (k*(length-L))); @@ -1152,6 +1156,9 @@ DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s, s->flags |= CLOTH_SPRING_FLAG_NEEDED; k = clmd->sim_parms->bending; + + scaling = k + s->stiffness * (clmd->sim_parms->max_bend-k); + cb = k = scaling; mul_fvector_S(bending_force, dir, fbstar(length, L, k, cb)); VECADD(s->f, s->f, bending_force); diff --git a/source/blender/makesdna/DNA_cloth_types.h b/source/blender/makesdna/DNA_cloth_types.h index ab47d00d1b5..93aa09db349 100644 --- a/source/blender/makesdna/DNA_cloth_types.h +++ b/source/blender/makesdna/DNA_cloth_types.h @@ -47,24 +47,24 @@ **/ typedef struct SimulationSettings { - short vgroup_mass; /* optional vertexgroup name for assigning weight. */ - short pad; + short vgroup_mass; /* optional vertexgroup name for assigning weight.*/ + short vgroup_struct; /* vertex group for scaling structural stiffness */ float mingoal; /* see SB */ int preroll; /* How many frames of simulation to do before we start. */ float Cdis; /* Mechanical damping of springs. */ float Cvi; /* Viscous/fluid damping. */ - int stepsPerFrame; /* Number of time steps per frame. */ - float gravity [3]; /* Gravity/external force vector. */ + int stepsPerFrame; /* Number of time steps per frame. */ + float gravity [3]; /* Gravity/external force vector. */ float ufluid [3]; /* Velocity vector of the fluid. */ - float dt; /* This is the duration of our time step, computed. */ + float dt; /* This is the duration of our time step, computed. */ float mass; /* The mass of the entire cloth. */ float structural; /* Structural spring stiffness. */ float shear; /* Shear spring stiffness. */ float bending; /* Flexion spring stiffness. */ float sim_time; int flags; /* flags, see CSIMSETT_FLAGS enum above. */ - short solver_type; /* which solver should be used? txold */ - short pad2; + short solver_type; /* which solver should be used? txold */ + short vgroup_bend; /* vertex group for scaling bending stiffness */ float maxgoal; /* see SB */ float eff_force_scale;/* Scaling of effector forces (see softbody_calc_forces).*/ float eff_wind_scale; /* Scaling of effector wind (see softbody_calc_forces). */ @@ -77,7 +77,11 @@ typedef struct SimulationSettings int lastframe; /* frame on which simulation stops */ int firstframe; /* frame on which simulation starts */ int lastcachedframe; - int editedframe; /* which frame is in buffer */ + int editedframe; /* which frame is in buffer */ + int autoprotect; /* starting from this frame, cache gets protected */ + float max_bend; /* max bending scaling value, min is "bending" */ + float max_struct; /* max structural scaling value, min is "structural" */ + float max_shear; /* max shear scaling value, UNUSED */ } SimulationSettings; diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c index 5ec89c6534e..7b87dd2108c 100644 --- a/source/blender/src/buttons_object.c +++ b/source/blender/src/buttons_object.c @@ -2325,6 +2325,7 @@ void do_object_panels(unsigned short event) { /* force freeing because user wants */ clmd->sim_parms->flags |= CLOTH_SIMSETTINGS_FLAG_CCACHE_FFREE; + cloth_clear_cache(ob, clmd, MAX2(1.0,G.scene->r.cfra)); // MAX2(1.0,G.scene->r.cfra + 1.0) allqueue(REDRAWBUTSOBJECT, 0); @@ -5036,13 +5037,31 @@ static void object_cloth__enabletoggle(void *ob_v, void *arg2) if (!md) { md = modifier_new(eModifierType_Cloth); BLI_addhead(&ob->modifiers, md); + + allqueue(REDRAWBUTSEDIT, 0); } else { + Object *ob = ob_v; + ModifierData *md = modifiers_findByType(ob, eModifierType_Cloth); + + if (!md) + return; + BLI_remlink(&ob->modifiers, md); + modifier_free(md); - } - allqueue(REDRAWBUTSEDIT, 0); + BIF_undo_push("Del modifier"); + + ob->softflag |= OB_SB_RESET; + allqueue(REDRAWBUTSEDIT, 0); + allqueue(REDRAWVIEW3D, 0); + allqueue(REDRAWIMAGE, 0); + allqueue(REDRAWOOPS, 0); + DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA); + object_handle_update(ob); + countall(); + } } @@ -5068,7 +5087,7 @@ static void object_panel_cloth(Object *ob) { int defCount; char *clvg1, *clvg2; - char clmvg [] = "Weight Paint Groups%t|"; + char clmvg [] = "Vertex Groups%t|"; val2=0; @@ -5177,22 +5196,12 @@ static void object_panel_cloth_II(Object *ob) clmd = (ClothModifierData *)modifiers_findByType(ob, eModifierType_Cloth); if(clmd) - { - // char str[128]; - + { 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"); uiDefBut(block, LABEL, 0, "",10,140,300,20, NULL, 0.0, 0, 0, 0, ""); - /* 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); - */ - if (!G.relbase_valid) { uiDefBut(block, LABEL, 0, "Cache deactivated until file is saved.", 10,120,300,20, NULL, 0.0, 0, 0, 0, ""); @@ -5209,6 +5218,7 @@ static void object_panel_cloth_II(Object *ob) } /* + TODO: implement this again in cloth! 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 @@ -5219,6 +5229,7 @@ static void object_panel_cloth_II(Object *ob) if (clmd->coll_parms->flags & CLOTH_COLLSETTINGS_FLAG_ENABLED) { uiDefButF(block, NUM, B_CLOTH_RENEW, "Min Distance:", 160,60,150,20, &clmd->coll_parms->epsilon, 0.001f, 1.0, 0.01f, 0, "Minimum distance between collision objects before collision response takes in"); + uiDefButS(block, NUM, REDRAWBUTSOBJECT, "Collision Quality:", 10,40,300,20, &clmd->coll_parms->loop_count, 1.0, 100.0, 1.0, 0, "How many collision iterations should be done. (higher = better = slower), je be changed for each frame"); } else uiDefBut(block, LABEL, 0, "",160,60,150,20, NULL, 0.0, 0, 0, 0, ""); @@ -5228,6 +5239,102 @@ static void object_panel_cloth_II(Object *ob) } +static void object_panel_cloth_III(Object *ob) +{ + uiBlock *block; + ClothModifierData *clmd = NULL; + + block= uiNewBlock(&curarea->uiblocks, "object_cloth_III", UI_EMBOSS, UI_HELV, curarea->win); + uiNewPanelTabbed("Cloth ", "Physics"); + if(uiNewPanel(curarea, block, "Cloth Advanced", "Physics", 651, 0, 318, 204)==0) return; + + uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE); + + clmd = (ClothModifierData *)modifiers_findByType(ob, eModifierType_Cloth); + + if(clmd) + { + int defCount; + char *clvg1, *clvg2; + char clmvg [] = "Vertex Groups%t|None%x0|"; + char clmvg2 [] = "Vertex Groups%t|None%x0|"; + + uiDefButI(block, NUM, B_DIFF, "Autoprotect Cache From:",10,160,300,20, &clmd->sim_parms->autoprotect, 0, MAXFRAME, 1, 0, "Frame on which the simulation gets cache protection enabled automatically (To prevent accidently cleaning it)."); + + uiDefButBitI(block, TOG, CLOTH_SIMSETTINGS_FLAG_SCALING, REDRAWVIEW3D, "Enable stiffness scaling",10,130,300,20, &clmd->sim_parms->flags, 0, 0, 0, 0, "If enabled, stiffness can be scaled along a weight painted vertex group."); + + if ((clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_SCALING)&& (BLI_countlist (&ob->defbase) > 0)) + { + uiDefBut(block, LABEL, 0, "StructStiff VGroup:",10,110,150,20, NULL, 0.0, 0, 0, 0, ""); + uiDefBut(block, LABEL, 0, "BendStiff VGroup:",160,110,150,20, NULL, 0.0, 0, 0, 0, ""); + + defCount = sizeof (clmvg); + clvg1 = get_vertexgroup_menustr (ob); + clvg2 = MEM_callocN (strlen (clvg1) + 1 + defCount, "clothVgST"); + 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_struct = 0; + } + else + { + if(clmd->sim_parms->vgroup_struct > defCount) + clmd->sim_parms->vgroup_struct = 0; + } + + sprintf (clvg2, "%s%s", clmvg, clvg1); + + uiDefButS(block, MENU, B_CLOTH_RENEW, clvg2, 10,90,150,20, &clmd->sim_parms->vgroup_struct, 0, defCount, 0, 0, "Browses available vertex groups"); + MEM_freeN (clvg1); + MEM_freeN (clvg2); + + defCount = sizeof (clmvg); + clvg1 = get_vertexgroup_menustr (ob); + clvg2 = MEM_callocN (strlen (clvg1) + 1 + defCount, "clothVgBD"); + 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_bend = 0; + } + else + { + if(clmd->sim_parms->vgroup_bend > defCount) + clmd->sim_parms->vgroup_bend = 0; + } + + sprintf (clvg2, "%s%s", clmvg2, clvg1); + + uiDefButS(block, MENU, B_CLOTH_RENEW, clvg2, 160,90,150,20, &clmd->sim_parms->vgroup_bend, 0, defCount, 0, 0, "Browses available vertex groups"); + MEM_freeN (clvg1); + MEM_freeN (clvg2); + + uiDefButF(block, NUM, B_CLOTH_RENEW, "StructStiff Max:",10,70,150,20, &clmd->sim_parms->max_struct, clmd->sim_parms->structural, 1000.0, 0.01f, 0, "Maximum structural stiffness value"); + + uiDefButF(block, NUM, B_CLOTH_RENEW, "BendStiff Max:",160,70,150,20, &clmd->sim_parms->max_bend, clmd->sim_parms->bending, 1000.0, 0.01f, 0, "Maximum bending stiffness value"); + + } + else if (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_SCALING) + { + uiDefBut(block, LABEL, 0, " ", 10,110,300,20, NULL, 0.0, 0, 0, 0, ""); + uiDefBut(block, LABEL, 0, "No vertex group for pinning available.", 10,90,300,20, NULL, 0.0, 0, 0, 0, ""); + } + + + + } + + uiBlockEndAlign(block); + +} + void object_panels() { Object *ob; @@ -5259,6 +5366,7 @@ void physics_panels() object_softbodies_solver(ob); object_panel_cloth(ob); object_panel_cloth_II(ob); + object_panel_cloth_III(ob); object_panel_fluidsim(ob); } } diff --git a/source/blender/src/vpaint.c b/source/blender/src/vpaint.c index 163b93468fe..dec15f96b8a 100644 --- a/source/blender/src/vpaint.c +++ b/source/blender/src/vpaint.c @@ -1353,7 +1353,6 @@ void weight_paint(void) if(modifiers_isClothEnabled(ob)) { ClothModifierData *clmd = (ClothModifierData *)modifiers_findByType(ob, eModifierType_Cloth); clmd->sim_parms->flags |= CLOTH_SIMSETTINGS_FLAG_RESET; - printf("vpaint.c\n"); } BIF_undo_push("Weight Paint"); |