diff options
Diffstat (limited to 'source/blender/src/buttons_editing.c')
-rw-r--r-- | source/blender/src/buttons_editing.c | 171 |
1 files changed, 156 insertions, 15 deletions
diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c index 28449a3fcd7..59652b6e68c 100644 --- a/source/blender/src/buttons_editing.c +++ b/source/blender/src/buttons_editing.c @@ -987,7 +987,7 @@ static uiBlock *modifiers_add_menu(void *ob_v) /* 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))) { @@ -1575,6 +1575,18 @@ static void build_uvlayer_menu_vars(CustomData *data, char **menu_string, } } +void set_wave_uvlayer(void *arg1, void *arg2) +{ + WaveModifierData *wmd=arg1; + CustomDataLayer *layer = arg2; + + /*check we have UV layers*/ + if (wmd->uvlayer_tmp < 1) return; + layer = layer + (wmd->uvlayer_tmp-1); + + strcpy(wmd->uvlayer_name, layer->name); +} + void set_displace_uvlayer(void *arg1, void *arg2) { DisplaceModifierData *dmd=arg1; @@ -1744,7 +1756,7 @@ static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco // 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); @@ -1815,6 +1827,8 @@ static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco 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) { @@ -1828,6 +1842,25 @@ static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco height = 94; } else if (md->type==eModifierType_Explode) { height = 94; + } else if (md->type==eModifierType_Shrinkwrap) { + ShrinkwrapModifierData *smd = (ShrinkwrapModifierData*) md; + height = 86 + 3; + if (smd->shrinkType == MOD_SHRINKWRAP_PROJECT) + { + height += 19*5; + if(smd->projAxis == 0) height += 19; + } + else if (smd->shrinkType == MOD_SHRINKWRAP_NEAREST_SURFACE) + height += 19; + } else if (md->type == eModifierType_Mask) { + height = 66; + } else if (md->type==eModifierType_SimpleDeform) { + SimpleDeformModifierData *smd = (SimpleDeformModifierData*) md; + height += 19*5; + if(smd->origin != NULL) height += 19; + if(smd->mode == MOD_SIMPLEDEFORM_MODE_STRETCH + || smd->mode == MOD_SIMPLEDEFORM_MODE_TAPER ) + height += 19; } /* 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, ""); @@ -1835,6 +1868,8 @@ static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco y -= 18; if (!isVirtual && (md->type!=eModifierType_Collision)) { + uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE); /* only here obdata, the rest of modifiers is ob level */ + 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"); @@ -1845,11 +1880,13 @@ static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco 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); } uiBlockEndAlign(block); + + uiSetButLock(ob && ob->id.lib, ERROR_LIBDATA_MESSAGE); } lx = x + 10; @@ -2102,6 +2139,30 @@ static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco uiDefButF(block, NUM, B_MODIFIER_RECALC, "Ratio:", lx,(cy-=19),buttonWidth,19, &dmd->percent, 0.0, 1.0, 10, 0, "Defines the percentage of triangles to reduce to"); sprintf(str, "Face Count: %d", dmd->faceCount); uiDefBut(block, LABEL, 1, str, lx, (cy-=19), 160,19, NULL, 0.0, 0.0, 0, 0, "Displays the current number of faces in the decimated mesh"); + } else if (md->type==eModifierType_Mask) { + MaskModifierData *mmd = (MaskModifierData *)md; + + sprintf(str, "Mask Mode%%t|Vertex Group%%x%d|Selected Bones%%x%d|", + MOD_MASK_MODE_VGROUP,MOD_MASK_MODE_ARM); + uiDefButI(block, MENU, B_MODIFIER_RECALC, str, + lx, (cy -= 19), buttonWidth, 19, &mmd->mode, + 0.0, 1.0, 0, 0, "How masking region is defined"); + + if (mmd->mode == MOD_MASK_MODE_ARM) { + uiDefIDPoinBut(block, modifier_testArmatureObj, ID_OB, B_CHANGEDEP, + "Ob: ", lx, (cy -= 19), buttonWidth, 19, &mmd->ob_arm, + "Armature to use as source of bones to mask"); + } + else { + but=uiDefBut(block, TEX, B_MODIFIER_RECALC, "VGroup: ", + lx, (cy-=19), buttonWidth, 19, &mmd->vgroup, + 0.0, 31.0, 0, 0, "Vertex Group name"); + uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)ob); + } + + uiDefButBitI(block, TOG, MOD_MASK_INV, B_MODIFIER_RECALC, "Inverse", + lx, (cy-=19), buttonWidth, 19, &mmd->flag, + 0, 0, 0, 0, "Use vertices that are not part of region defined"); } else if (md->type==eModifierType_Smooth) { SmoothModifierData *smd = (SmoothModifierData*) md; @@ -2185,7 +2246,7 @@ static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco 0.0, 1.0, 0, 0, "Set the UV layer to use"); MEM_freeN(strtmp); i = CustomData_get_layer_index(fdata, CD_MTFACE); - uiButSetFunc(but, set_displace_uvlayer, wmd, + uiButSetFunc(but, set_wave_uvlayer, wmd, &fdata->layers[i]); } if(wmd->texmapping == MOD_DISP_MAP_OBJECT) { @@ -2240,8 +2301,11 @@ static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco uiDefBut(block, LABEL, 1, "See Soft Body panel.", lx, (cy-=19), buttonWidth,19, NULL, 0.0, 0.0, 0, 0, ""); } else if (md->type==eModifierType_Cloth) { 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"); @@ -2448,6 +2512,75 @@ static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco uiDefButBitS(block, TOG, eExplodeFlag_Alive, B_MODIFIER_RECALC, "Alive", lx+buttonWidth/3, cy, buttonWidth/3,19, &emd->flag, 0, 0, 0, 0, "Show mesh when particles are alive"); uiDefButBitS(block, TOG, eExplodeFlag_Dead, B_MODIFIER_RECALC, "Dead", lx+buttonWidth*2/3, cy, buttonWidth/3,19, &emd->flag, 0, 0, 0, 0, "Show mesh when particles are dead"); uiBlockEndAlign(block); + } else if (md->type==eModifierType_Shrinkwrap) { + ShrinkwrapModifierData *smd = (ShrinkwrapModifierData*) md; + + char shrinktypemenu[]="Shrinkwrap type%t|nearest surface point %x0|projection %x1|nearest vertex %x2"; + + uiDefIDPoinBut(block, modifier_testMeshObj, ID_OB, B_CHANGEDEP, "Ob: ", lx, (cy-=19), buttonWidth,19, &smd->target, "Target to shrink to"); + + but=uiDefBut(block, TEX, B_MODIFIER_RECALC, "VGroup: ", lx, (cy-=19), buttonWidth,19, &smd->vgroup_name, 0, 31, 0, 0, "Vertex Group name"); + uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)ob); + + uiDefButF(block, NUM, B_MODIFIER_RECALC, "Offset:", lx,(cy-=19),buttonWidth,19, &smd->keepDist, 0.0f, 100.0f, 1.0f, 0, "Specify distance to keep from the target"); + + cy -= 3; + uiDefButS(block, MENU, B_MODIFIER_RECALC, shrinktypemenu, lx,(cy-=19),buttonWidth,19, &smd->shrinkType, 0, 0, 0, 0, "Selects type of shrinkwrap algorithm for target position."); + + if (smd->shrinkType == MOD_SHRINKWRAP_PROJECT){ + + + /* UI for projection axis */ + uiBlockBeginAlign(block); + uiDefButC(block, ROW, B_MODIFIER_RECALC, "Normal" , lx,(cy-=19),buttonWidth,19, &smd->projAxis, 18.0, MOD_SHRINKWRAP_PROJECT_OVER_NORMAL, 0, 0, "Projection over X axis"); + if(smd->projAxis == 0) + { + uiDefButC(block, NUM, B_MODIFIER_RECALC, "SS Levels:", lx, (cy-=19), buttonWidth,19, &smd->subsurfLevels, 0, 6, 0, 0, "This indicates the number of CCSubdivisions that must be performed before extracting vertexs positions and normals"); + } + + uiDefButBitC(block, TOG, MOD_SHRINKWRAP_PROJECT_OVER_X_AXIS, B_MODIFIER_RECALC, "X", lx+buttonWidth/3*0,(cy-=19),buttonWidth/3,19, &smd->projAxis, 0, 0, 0, 0, "Projection over X axis"); + uiDefButBitC(block, TOG, MOD_SHRINKWRAP_PROJECT_OVER_Y_AXIS, B_MODIFIER_RECALC, "Y", lx+buttonWidth/3*1,cy,buttonWidth/3,19, &smd->projAxis, 0, 0, 0, 0, "Projection over Y axis"); + uiDefButBitC(block, TOG, MOD_SHRINKWRAP_PROJECT_OVER_Z_AXIS, B_MODIFIER_RECALC, "Z", lx+buttonWidth/3*2,cy,buttonWidth/3,19, &smd->projAxis, 0, 0, 0, 0, "Projection over Z axis"); + + + /* allowed directions of projection axis */ + uiDefButBitS(block, TOG, MOD_SHRINKWRAP_PROJECT_ALLOW_NEG_DIR, B_MODIFIER_RECALC, "Negative", lx,(cy-=19),buttonWidth/2,19, &smd->shrinkOpts, 0, 0, 0, 0, "Allows to move the vertex in the negative direction of axis"); + uiDefButBitS(block, TOG, MOD_SHRINKWRAP_PROJECT_ALLOW_POS_DIR, B_MODIFIER_RECALC, "Positive", lx + buttonWidth/2,cy,buttonWidth/2,19, &smd->shrinkOpts, 0, 0, 0, 0, "Allows to move the vertex in the positive direction of axis"); + + uiDefButBitS(block, TOG, MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE, B_MODIFIER_RECALC, "Cull frontfaces",lx,(cy-=19),buttonWidth/2,19, &smd->shrinkOpts, 0, 0, 0, 0, "Controls whether a vertex can be projected to a front face on target"); + uiDefButBitS(block, TOG, MOD_SHRINKWRAP_CULL_TARGET_BACKFACE, B_MODIFIER_RECALC, "Cull backfaces", lx+buttonWidth/2,cy,buttonWidth/2,19, &smd->shrinkOpts, 0, 0, 0, 0, "Controls whether a vertex can be projected to a back face on target"); + uiDefIDPoinBut(block, modifier_testMeshObj, ID_OB, B_CHANGEDEP, "Ob2: ", lx, (cy-=19), buttonWidth,19, &smd->auxTarget, "Aditional mesh to project over"); + } + else if (smd->shrinkType == MOD_SHRINKWRAP_NEAREST_SURFACE){ + uiDefButBitS(block, TOG, MOD_SHRINKWRAP_KEEP_ABOVE_SURFACE, B_MODIFIER_RECALC, "Above surface", lx,(cy-=19),buttonWidth,19, &smd->shrinkOpts, 0, 0, 0, 0, "Vertices are kept on the front side of faces"); + } + + uiBlockEndAlign(block); + + } else if (md->type==eModifierType_SimpleDeform) { + SimpleDeformModifierData *smd = (SimpleDeformModifierData*) md; + char simpledeform_modemenu[] = "Deform type%t|Twist %x1|Bend %x2|Taper %x3|Strech %x4"; + + uiDefButC(block, MENU, B_MODIFIER_RECALC, simpledeform_modemenu, lx,(cy-=19),buttonWidth,19, &smd->mode, 0, 0, 0, 0, "Selects type of deform to apply to object."); + + but=uiDefBut(block, TEX, B_MODIFIER_RECALC, "VGroup: ", lx, (cy-=19), buttonWidth,19, &smd->vgroup_name, 0, 31, 0, 0, "Vertex Group name"); + uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)ob); + + uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CHANGEDEP, "Ob: ", lx, (cy-=19), buttonWidth,19, &smd->origin, "Origin of modifier space coordinates"); + if(smd->origin != NULL) + uiDefButBitC(block, TOG, MOD_SIMPLEDEFORM_ORIGIN_LOCAL, B_MODIFIER_RECALC, "Relative",lx,(cy-=19),buttonWidth,19, &smd->originOpts, 0, 0, 0, 0, "Sets the origin of deform space to be relative to the object"); + + uiDefButF(block, NUM, B_MODIFIER_RECALC, "Factor:", lx,(cy-=19),buttonWidth,19, &smd->factor, -10.0f, 10.0f, 0.5f, 0, "Deform Factor"); + + uiDefButF(block, NUM, B_MODIFIER_RECALC, "Upper Limit:", lx,(cy-=19),buttonWidth,19, &smd->limit[1], 0.0f, 1.0f, 5.0f, 0, "Upper Limit for deform"); + uiDefButF(block, NUM, B_MODIFIER_RECALC, "Lower Limit:", lx,(cy-=19),buttonWidth,19, &smd->limit[0], 0.0f, 1.0f, 5.0f, 0, "Lower Limit for deform"); + + if(smd->mode == MOD_SIMPLEDEFORM_MODE_STRETCH + || smd->mode == MOD_SIMPLEDEFORM_MODE_TAPER ) + { + uiDefButBitC(block, TOG, MOD_SIMPLEDEFORM_LOCK_AXIS_X, B_MODIFIER_RECALC, "Loc X", lx, (cy-=19),buttonWidth/2,19, &smd->axis, 0, 0, 0, 0, "Disallow changes on the X coordinate"); + uiDefButBitC(block, TOG, MOD_SIMPLEDEFORM_LOCK_AXIS_Y, B_MODIFIER_RECALC, "Loc Y", lx+(buttonWidth/2), (cy),buttonWidth/2,19, &smd->axis, 0, 0, 0, 0, "Disallow changes on the Y coordinate"); + } } uiBlockEndAlign(block); @@ -2487,7 +2620,7 @@ static void editing_panel_modifiers(Object *ob) block= uiNewBlock(&curarea->uiblocks, "editing_panel_modifiers", UI_EMBOSS, UI_HELV, curarea->win); if( uiNewPanel(curarea, block, "Modifiers", "Editing", 640, 0, 318, 204)==0) return; - uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE); + uiSetButLock((ob && ob->id.lib), ERROR_LIBDATA_MESSAGE); uiNewPanelHeight(block, 204); uiDefBlockBut(block, modifiers_add_menu, ob, "Add Modifier", 0, 190, 130, 20, "Add a new modifier"); @@ -3288,9 +3421,9 @@ static void editing_panel_curve_tools(Object *ob, Curve *cu) if(ob->type==OB_CURVE) { uiDefBut(block, LABEL, 0, "Convert", 463,173,72, 18, 0, 0, 0, 0, 0, ""); uiBlockBeginAlign(block); - uiDefBut(block, BUT,B_CONVERTPOLY,"Poly", 467,152,72, 18, 0, 0, 0, 0, 0, "Converts selected into regular Polygon vertices"); - uiDefBut(block, BUT,B_CONVERTBEZ,"Bezier", 467,132,72, 18, 0, 0, 0, 0, 0, "Converts selected to Bezier triples"); - uiDefBut(block, BUT,B_CONVERTNURB,"Nurb", 467,112,72, 18, 0, 0, 0, 0, 0, "Converts selected to Nurbs Points"); + uiDefBut(block, BUT,B_CONVERTPOLY,"Poly", 450,152,110, 18, 0, 0, 0, 0, 0, "Converts selected into regular Polygon vertices"); + uiDefBut(block, BUT,B_CONVERTBEZ,"Bezier", 450,132,110, 18, 0, 0, 0, 0, 0, "Converts selected to Bezier triples"); + uiDefBut(block, BUT,B_CONVERTNURB,"Nurb", 450,112,110, 18, 0, 0, 0, 0, 0, "Converts selected to Nurbs Points"); } uiBlockBeginAlign(block); uiDefBut(block, BUT,B_UNIFU,"Uniform U", 565,152,102, 18, 0, 0, 0, 0, 0, "Nurbs only; interpolated result doesn't go to end points in U"); @@ -3301,7 +3434,7 @@ static void editing_panel_curve_tools(Object *ob, Curve *cu) uiDefBut(block, BUT,B_BEZV,"V", 670,112,50, 18, 0, 0, 0, 0, 0, "Nurbs only; make knots array mimic a Bezier in V"); uiBlockEndAlign(block); - uiDefBut(block, BUT,B_SETWEIGHT,"Set Weight", 465,11,95,49, 0, 0, 0, 0, 0, "Nurbs only; set weight for select points"); + uiDefBut(block, BUT,B_SETWEIGHT,"Set Weight", 450,11,110,49, 0, 0, 0, 0, 0, "Nurbs only; set weight for select points"); uiBlockBeginAlign(block); uiDefButF(block, NUM,0,"Weight:", 565,36,102,22, &editbutweight, 0.01, 100.0, 10, 0, "The weight you can assign"); @@ -3320,10 +3453,15 @@ static void editing_panel_curve_tools(Object *ob, Curve *cu) if(nu) { if (ob->type==OB_CURVE) { uiDefBut(block, LABEL, 0, "Tilt", - 467,87,72, 18, 0, 0, 0, 0, 0, ""); + 450,90,72, 18, 0, 0, 0, 0, 0, ""); /* KEY_LINEAR, KEY_CARDINAL, KEY_BSPLINE */ - uiDefButS(block, MENU, B_TILTINTERP, "Tilt Interpolation %t|Linear %x0|Cardinal %x1|BSpline %x2", - 467,67,72, 18, &(nu->tilt_interp), 0, 0, 0, 0, "Tilt interpolation"); + uiDefButS(block, MENU, B_TILTINTERP, "Tilt Interpolation %t|Linear%x0|Cardinal%x1|BSpline %x2|Ease%x3", + 495,90,66, 18, &(nu->tilt_interp), 0, 0, 0, 0, "Tadius interpolation for 3D curves"); + + uiDefBut(block, LABEL, 0, "Radius", + 450,70,72, 18, 0, 0, 0, 0, 0, ""); + uiDefButS(block, MENU, B_TILTINTERP, "Radius Interpolation %t|Linear%x0|Cardinal%x1|BSpline %x2|Ease%x3", + 495,70,66, 18, &(nu->radius_interp), 0, 0, 0, 0, "Radius interpolation"); } uiBlockBeginAlign(block); @@ -3617,11 +3755,9 @@ static void editing_panel_camera_yafraydof(Object *ob, Camera *cam) void do_cambuts(unsigned short event) { Object *ob; - Camera *cam; ob= OBACT; if (ob==0) return; - cam= ob->data; switch(event) { case 0: @@ -4147,7 +4283,7 @@ static void validate_posebonebutton_cb(void *bonev, void *namev) static void armature_layer_cb(void *lay_v, void *value_v) { short *layer= lay_v; - int value= (long)value_v; + int value= (intptr_t)value_v; if(*layer==0 || G.qual==0) *layer= value; allqueue(REDRAWBUTSEDIT, 0); @@ -6314,6 +6450,11 @@ static void editing_panel_mesh_uvautocalculation(void) row= 180; uiDefButBitS(block, TOGN, UVCALC_NO_ASPECT_CORRECT, B_NOP, "Image Aspect",100,row,200,butH,&G.scene->toolsettings->uvcalc_flag, 0, 0, 0, 0, "Scale the UV Unwrapping to correct for the current images aspect ratio"); + + row-= butHB+butS; + uiDefButBitS(block, TOG, UVCALC_TRANSFORM_CORRECT, B_NOP, "Transform Correction",100,row,200,butH,&G.scene->toolsettings->uvcalc_flag, 0, 0, 0, 0, "Correct for UV distortion while transforming, (only works with edge slide now)"); + + row= 180; uiBlockBeginAlign(block); uiDefButF(block, NUM,B_UVAUTO_CUBESIZE ,"Cube Size:",315,row,200,butH, &G.scene->toolsettings->uvcalc_cubesize, 0.0001, 100.0, 10, 3, "Defines the cubemap size for cube mapping"); |