Merging with trunk up to r38631.
authorJoerg Mueller <nexyon@gmail.com>
Sat, 23 Jul 2011 16:34:30 +0000 (16:34 +0000)
committerJoerg Mueller <nexyon@gmail.com>
Sat, 23 Jul 2011 16:34:30 +0000 (16:34 +0000)
1  2 
release/scripts/startup/bl_ui/space_view3d.py
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_ops.c
source/blender/makesdna/DNA_scene_types.h
source/blender/makesrna/intern/rna_scene.c
source/gameengine/Expressions/PyObjectPlus.h

@@@ -68,7 -68,7 +68,7 @@@ class VIEW3D_HT_header(bpy.types.Header
          if obj:
              # Particle edit
              if obj.mode == 'PARTICLE_EDIT':
-                 row.prop(toolsettings.particle_edit, "select_mode", text="", expand=True, toggle=True)
+                 row.prop(toolsettings.particle_edit, "select_mode", text="", expand=True)
  
              # Occlude geometry
              if view.viewport_shade in {'SOLID', 'SHADED', 'TEXTURED'} and (obj.mode == 'PARTICLE_EDIT' or (obj.mode == 'EDIT' and obj.type == 'MESH')):
@@@ -183,10 -183,6 +183,10 @@@ class VIEW3D_MT_transform(bpy.types.Men
  
          layout.operator("object.randomize_transform")
          layout.operator("object.align")
 +        
 +        layout.separator()
 +        
 +        layout.operator("object.anim_transforms_to_deltas")
  
  
  class VIEW3D_MT_mirror(bpy.types.Menu):
@@@ -969,7 -969,7 +969,7 @@@ int transformEvent(TransInfo *t, wmEven
                        break;
                case OKEY:
                        if (t->flag & T_PROP_EDIT && event->shift) {
-                               t->prop_mode = (t->prop_mode + 1) % 6;
+                               t->prop_mode = (t->prop_mode + 1) % PROP_MODE_MAX;
                                calculatePropRatio(t);
                                t->redraw |= TREDRAW_HARD;
                        }
@@@ -1982,15 -1982,12 +1982,15 @@@ static void protectedQuaternionBits(sho
  
  /* ******************* TRANSFORM LIMITS ********************** */
  
 -static void constraintTransLim(TransInfo *UNUSED(t), TransData *td)
 +static void constraintTransLim(TransInfo *t, TransData *td)
  {
        if (td->con) {
 -              bConstraintTypeInfo *cti= get_constraint_typeinfo(CONSTRAINT_TYPE_LOCLIMIT);
 +              bConstraintTypeInfo *ctiLoc= get_constraint_typeinfo(CONSTRAINT_TYPE_LOCLIMIT);
 +              bConstraintTypeInfo *ctiDist= get_constraint_typeinfo(CONSTRAINT_TYPE_DISTLIMIT);
 +              
                bConstraintOb cob= {NULL};
                bConstraint *con;
 +              float ctime = (float)(t->scene->r.cfra);
                
                /* Make a temporary bConstraintOb for using these limit constraints
                 *      - they only care that cob->matrix is correctly set ;-)
                
                /* Evaluate valid constraints */
                for (con= td->con; con; con= con->next) {
 +                      bConstraintTypeInfo *cti = NULL;
 +                      ListBase targets = {NULL, NULL};
                        float tmat[4][4];
                        
                        /* only consider constraint if enabled */
                                
                                if ((data->flag2 & LIMIT_TRANSFORM)==0)
                                        continue;
 +                              cti = ctiLoc;
 +                      }
 +                      else if (con->type == CONSTRAINT_TYPE_DISTLIMIT) {
 +                              bDistLimitConstraint *data= con->data;
                                
 +                              if ((data->flag & LIMITDIST_TRANSFORM)==0)
 +                                      continue;
 +                              cti = ctiDist;
 +                      }
 +                      
 +                      if (cti) {
                                /* do space conversions */
                                if (con->ownspace == CONSTRAINT_SPACE_WORLD) {
                                        /* just multiply by td->mtx (this should be ok) */
                                        continue;
                                }
                                
 +                              /* get constraint targets if needed */
 +                              get_constraint_targets_for_solving(con, &cob, &targets, ctime);
 +                              
                                /* do constraint */
 -                              cti->evaluate_constraint(con, &cob, NULL);
 +                              cti->evaluate_constraint(con, &cob, &targets);
                                
                                /* convert spaces again */
                                if (con->ownspace == CONSTRAINT_SPACE_WORLD) {
                                        copy_m4_m4(tmat, cob.matrix);
                                        mul_m4_m3m4(cob.matrix, td->smtx, tmat);
                                }
 +                              
 +                              /* free targets list */
 +                              BLI_freelistN(&targets);
                        }
                }
                
@@@ -5804,8 -5783,8 +5804,8 @@@ int TimeSlide(TransInfo *t, const int m
        char str[200];
  
        /* calculate mouse co-ordinates */
 -      UI_view2d_region_to_view(v2d, mval[0], mval[0], &cval[0], &cval[1]);
 -      UI_view2d_region_to_view(v2d, t->imval[0], t->imval[0], &sval[0], &sval[1]);
 +      UI_view2d_region_to_view(v2d, mval[0], mval[1], &cval[0], &cval[1]);
 +      UI_view2d_region_to_view(v2d, t->imval[0], t->imval[1], &sval[0], &sval[1]);
  
        /* t->values[0] stores cval[0], which is the current mouse-pointer location (in frames) */
        // XXX Need to be able to repeat this
@@@ -87,6 -87,7 +87,7 @@@
  #include "ED_object.h"
  #include "ED_markers.h"
  #include "ED_mesh.h"
+ #include "ED_node.h"
  #include "ED_types.h"
  #include "ED_uvedit.h"
  #include "ED_curve.h" /* for ED_curve_editnurbs */
@@@ -2182,6 -2183,12 +2183,12 @@@ void flushTransNodes(TransInfo *t
                td->loc2d[0]= td->loc[0];
                td->loc2d[1]= td->loc[1];
        }
+       
+       /* handle intersection with noodles */
+       if(t->total==1) {
+               ED_node_link_intersect_test(t->sa, 1);
+       }
+       
  }
  
  /* *** SEQUENCE EDITOR *** */
@@@ -2479,7 -2486,6 +2486,7 @@@ static short FrameOnMouseSide(char side
  static void createTransNlaData(bContext *C, TransInfo *t)
  {
        Scene *scene= t->scene;
 +      SpaceNla *snla = NULL;
        TransData *td = NULL;
        TransDataNla *tdn = NULL;
        
        /* determine what type of data we are operating on */
        if (ANIM_animdata_get_context(C, &ac) == 0)
                return;
 +      snla = (SpaceNla *)ac.sl;
        
        /* filter data */
 -      filter= (ANIMFILTER_VISIBLE | ANIMFILTER_NLATRACKS | ANIMFILTER_FOREDIT);
 +      filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
        ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
        
        /* which side of the current frame should be allowed */
                                                tdn->strip= strip;
                                                tdn->trackIndex= BLI_findindex(&adt->nla_tracks, nlt);
                                                
 -                                              yval= (float)(tdn->trackIndex * NLACHANNEL_STEP);
 +                                              yval= (float)(tdn->trackIndex * NLACHANNEL_STEP(snla));
                                                
                                                tdn->h1[0]= strip->start;
                                                tdn->h1[1]= yval;
  static void posttrans_gpd_clean (bGPdata *gpd)
  {
        bGPDlayer *gpl;
 -
 +      
        for (gpl= gpd->layers.first; gpl; gpl= gpl->next) {
                ListBase sel_buffer = {NULL, NULL};
                bGPDframe *gpf, *gpfn;
@@@ -2836,7 -2841,7 +2843,7 @@@ static void posttrans_action_clean (bAn
        int filter;
  
        /* filter data */
 -      filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
 +      filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/);
        ANIM_animdata_filter(ac, &anim_data, filter, act, ANIMCONT_ACTION);
  
        /* loop through relevant data, removing keyframes as appropriate
         */
        for (ale= anim_data.first; ale; ale= ale->next) {
                AnimData *adt= ANIM_nla_mapping_get(ac, ale);
 -
 +              
                if (adt) {
                        ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1);
                        posttrans_fcurve_clean(ale->key_data);
@@@ -3038,9 -3043,9 +3045,9 @@@ static void createTransActionData(bCont
        
        /* filter data */
        if (ac.datatype == ANIMCONT_GPENCIL)
 -              filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT);
 +              filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT);
        else
 -              filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
 +              filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/);
        ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
        
        /* which side of the current frame should be allowed */
                float min=999999999.0f, max=-999999999.0f;
                int i;
                
 -              td= (t->data + 1);
 -              for (i=1; i < count; i+=3, td+=3) {
 +              td= t->data;
 +              for (i=0; i < count; i++, td++) {
                        if (min > *(td->val)) min= *(td->val);
                        if (max < *(td->val)) max= *(td->val);
                }
                
 +              if (min == max) {
 +                      /* just use the current frame ranges */
 +                      min = (float)PSFRA;
 +                      max = (float)PEFRA;
 +              }
 +              
                /* minx/maxx values used by TimeSlide are stored as a
                 * calloced 2-float array in t->customData. This gets freed
                 * in postTrans (T_FREE_CUSTOMDATA).
@@@ -3265,7 -3264,7 +3272,7 @@@ static void createTransGraphEditData(bC
                return;
        
        /* filter data */
 -      filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_CURVEVISIBLE);
 +      filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVE_VISIBLE);
        ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
        
        /* which side of the current frame should be allowed */
@@@ -4764,7 -4763,12 +4771,12 @@@ void special_aftertrans_update(bContex
  
        }
        else if (t->spacetype == SPACE_NODE) {
-               /* pass */
+               if(cancelled == 0)
+                       ED_node_link_insert(t->sa);
+               
+               /* clear link line */
+               ED_node_link_intersect_test(t->sa, 0);
+               
        }
        else if (t->spacetype == SPACE_ACTION) {
                SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first;
                if (ELEM(ac.datatype, ANIMCONT_DOPESHEET, ANIMCONT_SHAPEKEY)) {
                        ListBase anim_data = {NULL, NULL};
                        bAnimListElem *ale;
 -                      short filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
 +                      short filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/);
                        
                        /* get channels to work on */
                        ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
                                // XXX: BAD! this get gpencil datablocks directly from main db...
                                // but that's how this currently works :/
                                for (gpd = G.main->gpencil.first; gpd; gpd = gpd->id.next) {
 -                                      if (ID_REAL_USERS(gpd) > 1)
 +                                      if (ID_REAL_USERS(gpd))
                                                posttrans_gpd_clean(gpd);
                                }
                        }
                }
                
                /* make sure all F-Curves are set correctly */
 -              ANIM_editkeyframes_refresh(&ac);
 +              if (ac.datatype != ANIMCONT_GPENCIL)
 +                      ANIM_editkeyframes_refresh(&ac);
                
                /* clear flag that was set for time-slide drawing */
                saction->flag &= ~SACTION_MOVING;
                {
                        ListBase anim_data = {NULL, NULL};
                        bAnimListElem *ale;
 -                      short filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_CURVEVISIBLE);
 +                      short filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVE_VISIBLE);
                        
                        /* get channels to work on */
                        ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
                {
                        ListBase anim_data = {NULL, NULL};
                        bAnimListElem *ale;
 -                      short filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NLATRACKS);
 +                      short filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT);
                        
                        /* get channels to work on */
                        ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
@@@ -897,7 -897,7 +897,7 @@@ void transform_keymap_for_space(wmKeyCo
                        km= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, 0, 0);
                        RNA_enum_set(km->ptr, "mode", TFM_TIME_SCALE);
                        
 -                      km= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", TKEY, KM_PRESS, 0, 0);
 +                      km= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", TKEY, KM_PRESS, KM_SHIFT, 0);
                        RNA_enum_set(km->ptr, "mode", TFM_TIME_SLIDE);
                        break;
                case SPACE_IPO:
  
                        WM_keymap_add_item(keymap, OP_RESIZE, SKEY, KM_PRESS, 0, 0);
  
+                       WM_keymap_add_item(keymap, OP_SHEAR, SKEY, KM_PRESS, KM_ALT|KM_CTRL|KM_SHIFT, 0);
                        WM_keymap_add_item(keymap, "TRANSFORM_OT_mirror", MKEY, KM_PRESS, KM_CTRL, 0);
  
                        km = WM_keymap_add_item(keymap, "WM_OT_context_toggle", TABKEY, KM_PRESS, KM_SHIFT, 0);
@@@ -126,8 -126,6 +126,8 @@@ typedef struct FFMpegCodecData 
        int video_bitrate;
        int audio_bitrate;
        int audio_mixrate;
 +      int audio_channels;
 +      int audio_pad;
        float audio_volume;
        int gop_size;
        int flags;
@@@ -1109,7 -1107,8 +1109,8 @@@ typedef struct Scene 
  #define PROP_SHARP             3
  #define PROP_LIN               4
  #define PROP_CONST             5
- #define PROP_RANDOM           6
+ #define PROP_RANDOM            6
+ #define PROP_MODE_MAX          7
  
  /* toolsettings->proportional */
  #define PROP_EDIT_OFF                 0
@@@ -100,14 -100,6 +100,14 @@@ EnumPropertyItem snap_element_items[] 
        {SCE_SNAP_MODE_VOLUME, "VOLUME", ICON_SNAP_VOLUME, "Volume", "Snap to volume"},
        {0, NULL, 0, NULL, NULL}};
  
 +static EnumPropertyItem audio_channel_items[] = {
 +      {1, "MONO", 0, "Mono", "Set audio channels to mono"},
 +      {2, "STEREO", 0, "Stereo", "Set audio channels to stereo"},
 +      {4, "SURROUND4", 0, "4 Channels", "Set audio channels to 4 channels"},
 +      {6, "SURROUND51", 0, "5.1 Surround", "Set audio channels to 5.1 surround sound"},
 +      {8, "SURROUND71", 0, "7.1 Surround", "Set audio channels to 7.1 surround sound"},
 +      {0, NULL, 0, NULL, NULL}};
 +
  EnumPropertyItem image_type_items[] = {
        {0, "", 0, "Image", NULL},
        {R_BMP, "BMP", ICON_FILE_IMAGE, "BMP", "Output image in bitmap format"},
  #endif
        {R_AVIJPEG, "AVI_JPEG", ICON_FILE_MOVIE, "AVI JPEG", "Output video in AVI JPEG format"},
        {R_AVIRAW, "AVI_RAW", ICON_FILE_MOVIE, "AVI Raw", "Output video in AVI Raw format"},
+ #ifdef WITH_FRAMESERVER
        {R_FRAMESERVER, "FRAMESERVER", ICON_FILE_SCRIPT, "Frame Server", "Output image to a frameserver"},
+ #endif
  #ifdef WITH_FFMPEG
        {R_H264, "H264", ICON_FILE_MOVIE, "H.264", "Output video in H.264 format"},
        {R_FFMPEG, "FFMPEG", ICON_FILE_MOVIE, "MPEG", "Output video in MPEG format"},
@@@ -1057,14 -1051,10 +1059,14 @@@ static void rna_def_tool_settings(Blend
                {UV_SELECT_FACE, "FACE", ICON_UV_FACESEL, "Face", "Face selection mode"},
                {UV_SELECT_ISLAND, "ISLAND", ICON_UV_ISLANDSEL, "Island", "Island selection mode"},
                {0, NULL, 0, NULL, NULL}};
 -
 +      
 +      /* the construction of this enum is quite special - everything is stored as bitflags, 
 +       * with 1st position only for for on/off (and exposed as boolean), while others are mutually 
 +       * exclusive options but which will only have any effect when autokey is enabled
 +       */
        static EnumPropertyItem auto_key_items[] = {
 -              {AUTOKEY_MODE_NORMAL, "ADD_REPLACE_KEYS", 0, "Add & Replace", ""},
 -              {AUTOKEY_MODE_EDITKEYS, "REPLACE_KEYS", 0, "Replace", ""},
 +              {AUTOKEY_MODE_NORMAL & ~AUTOKEY_ON, "ADD_REPLACE_KEYS", 0, "Add & Replace", ""},
 +              {AUTOKEY_MODE_EDITKEYS & ~AUTOKEY_ON, "REPLACE_KEYS", 0, "Replace", ""},
                {0, NULL, 0, NULL, NULL}};
  
        static EnumPropertyItem retarget_roll_items[] = {
        RNA_def_property_ui_icon(prop, ICON_REC, 0);
        
        prop= RNA_def_property(srna, "auto_keying_mode", PROP_ENUM, PROP_NONE);
 -      RNA_def_property_enum_sdna(prop, NULL, "autokey_mode");
 +      RNA_def_property_enum_bitflag_sdna(prop, NULL, "autokey_mode");
        RNA_def_property_enum_items(prop, auto_key_items);
        RNA_def_property_ui_text(prop, "Auto-Keying Mode", "Mode of automatic keyframe insertion for Objects and Bones");
        
@@@ -2484,10 -2474,6 +2486,10 @@@ static void rna_def_scene_render_data(B
        RNA_def_property_ui_text(prop, "Volume", "Audio volume");
        RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
  
 +      prop= RNA_def_property(srna, "ffmpeg_audio_channels", PROP_ENUM, PROP_NONE);
 +      RNA_def_property_enum_sdna(prop, NULL, "ffcodecdata.audio_channels");
 +      RNA_def_property_enum_items(prop, audio_channel_items);
 +      RNA_def_property_ui_text(prop, "Audio Channels", "Sets the audio channel count");
  #endif
  
        prop= RNA_def_property(srna, "fps", PROP_INT, PROP_NONE);
@@@ -55,6 -55,7 +55,7 @@@
  #ifdef USE_MATHUTILS
  extern "C" {
  #include "../../blender/python/mathutils/mathutils.h" /* so we can have mathutils callbacks */
+ #include "../../blender/python/generic/py_capi_utils.h" /* for PyC_LineSpit only */
  }
  #endif
  
@@@ -254,15 -255,12 +255,15 @@@ typedef struct PyObjectPlus_Proxy 
  #define KX_PYMETHODTABLE_NOARGS(class_name, method_name) \
        {#method_name , (PyCFunction) class_name::sPy##method_name, METH_NOARGS, (const char *)class_name::method_name##_doc}
  
 +#define KX_PYMETHODTABLE_KEYWORDS(class_name, method_name) \
 +      {#method_name , (PyCFunction) class_name::sPy##method_name, METH_VARARGS|METH_KEYWORDS, (const char *)class_name::method_name##_doc}
 +
  /**
   * Function implementation macro
   */
  #define KX_PYMETHODDEF_DOC(class_name, method_name, doc_string) \
  const char class_name::method_name##_doc[] = doc_string; \
 -PyObject* class_name::Py##method_name(PyObject* args, PyObject*)
 +PyObject* class_name::Py##method_name(PyObject* args, PyObject* kwds)
  
  #define KX_PYMETHODDEF_DOC_VARARGS(class_name, method_name, doc_string) \
  const char class_name::method_name##_doc[] = doc_string; \