Merge of SimpleDeform modifier from soc-2008-jaguarandi branch
authorAndre Susano Pinto <andresusanopinto@gmail.com>
Fri, 26 Sep 2008 21:21:20 +0000 (21:21 +0000)
committerAndre Susano Pinto <andresusanopinto@gmail.com>
Fri, 26 Sep 2008 21:21:20 +0000 (21:21 +0000)
http://wiki.blender.org/index.php/User:Jaguarandi/SummerOfCode2008/SimpleDeform

1  2 
source/blender/blenkernel/intern/modifier.c
source/blender/makesdna/DNA_modifier_types.h
source/blender/src/buttons_editing.c

  #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 "BKE_deform.h"
  #include "BKE_shrinkwrap.h"
+ #include "BKE_simple_deform.h"
  
  #include "LOD_DependKludge.h"
  #include "LOD_decimation.h"
@@@ -36,8 -36,7 +36,9 @@@ typedef enum ModifierType 
        eModifierType_Collision,
        eModifierType_Bevel,
        eModifierType_Shrinkwrap,
 +      eModifierType_Fluidsim,
 +      eModifierType_Mask,
+       eModifierType_SimpleDeform,
        NUM_MODIFIER_TYPES
  } ModifierType;
  
@@@ -1842,16 -1846,20 +1842,23 @@@ static void draw_modifier(uiBlock *bloc
                        height = 94;
                } else if (md->type==eModifierType_Shrinkwrap) {
                        ShrinkwrapModifierData *smd = (ShrinkwrapModifierData*) md;
 -                      height = 105 + 3;
 -
 +                      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, ""); 
  
                        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);
  
                y-=height;