Merge branch 'master' into blender2.8
authorCampbell Barton <ideasman42@gmail.com>
Sun, 15 Apr 2018 10:03:09 +0000 (12:03 +0200)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 15 Apr 2018 10:03:09 +0000 (12:03 +0200)
28 files changed:
1  2 
source/blender/blenkernel/intern/action.c
source/blender/collada/ArmatureImporter.cpp
source/blender/editors/animation/anim_channels_edit.c
source/blender/editors/armature/armature_edit.c
source/blender/editors/armature/armature_naming.c
source/blender/editors/armature/armature_relations.c
source/blender/editors/armature/armature_select.c
source/blender/editors/armature/armature_skinning.c
source/blender/editors/armature/armature_utils.c
source/blender/editors/armature/editarmature_sketch.c
source/blender/editors/armature/meshlaplacian.c
source/blender/editors/armature/meshlaplacian.h
source/blender/editors/armature/pose_select.c
source/blender/editors/armature/pose_transform.c
source/blender/editors/include/ED_armature.h
source/blender/editors/object/object_add.c
source/blender/editors/object/object_modifier.c
source/blender/editors/object/object_relations.c
source/blender/editors/object/object_transform.c
source/blender/editors/screen/screen_context.c
source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
source/blender/editors/space_outliner/outliner_select.c
source/blender/editors/space_view3d/view3d_select.c
source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_generics.c
source/blender/editors/util/ed_transverts.c
source/blender/makesrna/intern/rna_armature.c
source/blenderplayer/bad_level_call_stubs/stubs.c

index 397691a409b635e2cfa5683c04a1bd47fe81a911,d81e557dbfdbf4846b0b81f67f0f8f6d81991afb..7149fb15f45638485e6e7b77e3c6584ba7af35f4
@@@ -99,8 -98,8 +99,8 @@@ void *get_bone_from_selectbuffer
                                /* Determine what the current bone is */
                                if (obedit == NULL || base->object != obedit) {
                                        /* no singular posemode, so check for correct object */
 -                                      if (base->selcol == (hitresult & 0xFFFF)) {
 +                                      if (base->object->select_color == (hitresult & 0xFFFF)) {
-                                               bone = get_indexed_bone(base->object, hitresult);
+                                               bone = ED_armature_bone_find_index(base->object, hitresult);
                                                
                                                if (findunsel)
                                                        sel = (bone->flag & BONE_SELECTED);
index 5c8e08a0d8975467a88855a1152ccaa6b549355c,0458fc4ed1bb433b9a3b066c1838873ef6723163..e25056a7a4a59d12daecd0f14fb72597f72964a1
@@@ -431,9 -424,8 +431,9 @@@ static void add_verts_to_dgroups
        MEM_freeN(verts);
  }
  
- void create_vgroups_from_armature(
 -void ED_object_vgroup_calc_from_armature(ReportList *reports, Scene *scene, Object *ob, Object *par,
 -                                  const int mode, const bool mirror)
++void ED_object_vgroup_calc_from_armature(
 +        ReportList *reports, const EvaluationContext *eval_ctx, Scene *scene, Object *ob, Object *par,
 +        const int mode, const bool mirror)
  {
        /* Lets try to create some vertex groups 
         * based on the bones of the parent armature.
index a66cedd8d4f124c7b561bf08de431b000c13f5d8,4b62fd15c0491e44cfc0c46f8f2cb1b5964ff872..1c23f71233d3186a2676517e455ba58f00105a56
@@@ -133,8 -132,8 +133,8 @@@ void ED_pose_bone_select(Object *ob, bP
  
  /* called from editview.c, for mode-less pose selection */
  /* assumes scene obact and basact is still on old situation */
- bool ED_do_pose_selectbuffer(
+ bool ED_armature_pose_select_pick_with_buffer(
 -        Scene *scene, Base *base, const unsigned int *buffer, short hits,
 +        ViewLayer *view_layer, Base *base, const unsigned int *buffer, short hits,
          bool extend, bool deselect, bool toggle, bool do_nearest)
  {
        Object *ob = base->object;
index 0dcc4f32e43314da910db5c4ce9075053d1ff572,567e477ec6cbc698611676577a850a0367ed7b30..186ca5313e58ef000e971272642036745f8ceb43
@@@ -139,29 -130,30 +139,30 @@@ void ED_armature_from_edit(struct bArma
  void ED_armature_to_edit(struct bArmature *arm);
  void ED_armature_edit_free(struct bArmature *arm);
  
- void ED_armature_deselect_all(struct Object *obedit);
- void ED_armature_deselect_all_visible(struct Object *obedit);
+ void ED_armature_edit_deselect_all(struct Object *obedit);
+ void ED_armature_edit_deselect_all_visible(struct Object *obedit);
  
- bool ED_do_pose_selectbuffer(
+ bool ED_armature_pose_select_pick_with_buffer(
 -        struct Scene *scene, struct Base *base, const unsigned int *buffer, short hits,
 +        struct ViewLayer *view_layer, struct Base *base, const unsigned int *buffer, short hits,
          bool extend, bool deselect, bool toggle, bool do_nearest);
- bool ED_armature_select_pick(struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle);
+ bool ED_armature_edit_select_pick(
+         struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle);
  int join_armature_exec(struct bContext *C, struct wmOperator *op);
- struct Bone *get_indexed_bone(struct Object *ob, int index);
- float ED_rollBoneToVector(EditBone *bone, const float new_up_axis[3], const bool axis_only);
- EditBone *ED_armature_bone_find_name(const struct ListBase *edbo, const char *name);
- EditBone *ED_armature_bone_get_mirrored(const struct ListBase *edbo, EditBone *ebo);
- void ED_armature_sync_selection(struct ListBase *edbo);
- void ED_armature_validate_active(struct bArmature *arm);
+ struct Bone *ED_armature_bone_find_index(struct Object *ob, int index);
+ float ED_armature_ebone_roll_to_vector(const EditBone *bone, const float new_up_axis[3], const bool axis_only);
+ EditBone *ED_armature_ebone_find_name(const struct ListBase *edbo, const char *name);
+ EditBone *ED_armature_ebone_get_mirrored(const struct ListBase *edbo, EditBone *ebo);
+ void ED_armature_edit_sync_selection(struct ListBase *edbo);
+ void ED_armature_edit_validate_active(struct bArmature *arm);
  
- EditBone *ED_armature_edit_bone_add_primitive(struct Object *obedit_arm, float length, bool view_aligned);
- EditBone *ED_armature_edit_bone_add(struct bArmature *arm, const char *name);
+ EditBone *ED_armature_ebone_add_primitive(struct Object *obedit_arm, float length, bool view_aligned);
+ EditBone *ED_armature_ebone_add(struct bArmature *arm, const char *name);
  
- void ED_armature_edit_bone_remove_ex(struct bArmature *arm, EditBone *exBone, bool clear_connected);
- void ED_armature_edit_bone_remove(struct bArmature *arm, EditBone *exBone);
+ void ED_armature_ebone_remove_ex(struct bArmature *arm, EditBone *exBone, bool clear_connected);
+ void ED_armature_ebone_remove(struct bArmature *arm, EditBone *exBone);
  
  bool ED_armature_ebone_is_child_recursive(EditBone *ebone_parent, EditBone *ebone_child);
- EditBone *ED_armature_bone_find_shared_parent(EditBone *ebone_child[], const unsigned int ebone_child_tot);
+ EditBone *ED_armature_ebone_find_shared_parent(EditBone *ebone_child[], const unsigned int ebone_child_tot);
  
  void ED_armature_ebone_to_mat3(EditBone *ebone, float mat[3][3]);
  void ED_armature_ebone_to_mat4(EditBone *ebone, float mat[4][4]);
  void ED_armature_ebone_from_mat3(EditBone *ebone, float mat[3][3]);
  void ED_armature_ebone_from_mat4(EditBone *ebone, float mat[4][4]);
  
- void transform_armature_mirror_update(struct Object *obedit);
+ void ED_armature_edit_transform_mirror_update(struct Object *obedit);
 -void ED_armature_origin_set(struct Scene *scene, struct Object *ob, float cursor[3], int centermode, int around);
 +void ED_armature_origin_set(struct Object *ob, float cursor[3], int centermode, int around);
  
  void ED_armature_transform_bones(struct bArmature *arm, float mat[4][4], const bool do_props);
- void ED_armature_apply_transform(struct Object *ob, float mat[4][4], const bool do_props);
+ void ED_armature_transform_apply(struct Object *ob, float mat[4][4], const bool do_props);
  void ED_armature_transform(struct bArmature *arm, float mat[4][4], const bool do_props);
  
  #define ARM_GROUPS_NAME     1
  #define ARM_GROUPS_ENVELOPE 2
  #define ARM_GROUPS_AUTO     3
  
- void create_vgroups_from_armature(
 -void ED_object_vgroup_calc_from_armature(struct ReportList *reports, struct Scene *scene, struct Object *ob,
 -                                  struct Object *par, const int mode, const bool mirror);
++void ED_object_vgroup_calc_from_armature(
 +        struct ReportList *reports, const struct EvaluationContext *eval_ctx, struct Scene *scene,
 +        struct Object *ob, struct Object *par, const int mode, const bool mirror);
  
  /* if bone is already in list, pass it as param to ignore it */
- void unique_editbone_name(struct ListBase *ebones, char *name, EditBone *bone);
+ void ED_armature_ebone_unique_name(struct ListBase *ebones, char *name, EditBone *bone);
  void ED_armature_bone_rename(struct bArmature *arm, const char *oldnamep, const char *newnamep);
  void ED_armature_bones_flip_names(struct bArmature *arm, struct ListBase *bones_names, const bool do_strip_numbers);
  
@@@ -205,13 -196,13 +206,13 @@@ void ED_armature_ebone_listbase_free(st
  void ED_armature_ebone_listbase_copy(struct ListBase *lb_dst, struct ListBase *lb_src);
  
  /* poseobject.c */
 -bool ED_object_posemode_exit_ex(struct Object *ob);
 +bool ED_object_posemode_exit_ex(struct Main *bmain, struct Object *ob);
  bool ED_object_posemode_exit(struct bContext *C, struct Object *ob);
 -bool ED_object_posemode_enter_ex(struct Object *ob);
 +bool ED_object_posemode_enter_ex(struct Main *bmain, struct Object *ob);
  bool ED_object_posemode_enter(struct bContext *C, struct Object *ob);
- void ED_pose_de_selectall(struct Object *ob, int select_mode, const bool ignore_visibility);
+ void ED_pose_deselect_all(struct Object *ob, int select_mode, const bool ignore_visibility);
  void ED_pose_bone_select(struct Object *ob, struct bPoseChannel *pchan, bool select);
 -void ED_pose_recalculate_paths(struct Scene *scene, struct Object *ob);
 +void ED_pose_recalculate_paths(struct bContext *C, struct Scene *scene, struct Object *ob);
  struct Object *ED_pose_object_from_context(struct bContext *C);
  
  /* sketch */
@@@ -235,11 -226,11 +236,12 @@@ void BDR_drawSketch(const struct bConte
  int BDR_drawSketchNames(struct ViewContext *vc);
  
  /* meshlaplacian.c */
- void mesh_deform_bind(struct Scene *scene,
 -void ED_mesh_deform_bind_callback(struct Scene *scene,
--                      struct MeshDeformModifierData *mmd,
--                      struct DerivedMesh *cagedm,
--                      float *vertexcos, int totvert, float cagemat[4][4]);
--      
++void ED_mesh_deform_bind_callback(
++        struct Scene *scene,
++        struct MeshDeformModifierData *mmd,
++        struct DerivedMesh *cagedm,
++        float *vertexcos, int totvert, float cagemat[4][4]);
++
  #ifdef __cplusplus
  }
  #endif
index 3443a268ef2baab3bbc30b3f47a3e0f05525edc7,4618d05133e6bd56b998572e038d53daf401f657..ba58c0d3d2a88b39f8b1946c3e2f05caaf1b916e
@@@ -784,15 -772,13 +784,15 @@@ bool ED_object_parent_set(ReportList *r
                                copy_v3_v3(ob->loc, vec);
                        }
                        else if (pararm && (ob->type == OB_MESH) && (par->type == OB_ARMATURE)) {
 -                              if (partype == PAR_ARMATURE_NAME)
 -                                      ED_object_vgroup_calc_from_armature(reports, scene, ob, par, ARM_GROUPS_NAME, false);
 -                              else if (partype == PAR_ARMATURE_ENVELOPE)
 -                                      ED_object_vgroup_calc_from_armature(reports, scene, ob, par, ARM_GROUPS_ENVELOPE, xmirror);
 +                              if (partype == PAR_ARMATURE_NAME) {
-                                       create_vgroups_from_armature(reports, &eval_ctx, scene, ob, par, ARM_GROUPS_NAME, false);
++                                      ED_object_vgroup_calc_from_armature(reports, &eval_ctx, scene, ob, par, ARM_GROUPS_NAME, false);
 +                              }
 +                              else if (partype == PAR_ARMATURE_ENVELOPE) {
-                                       create_vgroups_from_armature(reports, &eval_ctx, scene, ob, par, ARM_GROUPS_ENVELOPE, xmirror);
++                                      ED_object_vgroup_calc_from_armature(reports, &eval_ctx, scene, ob, par, ARM_GROUPS_ENVELOPE, xmirror);
 +                              }
                                else if (partype == PAR_ARMATURE_AUTO) {
                                        WM_cursor_wait(1);
-                                       create_vgroups_from_armature(reports, &eval_ctx, scene, ob, par, ARM_GROUPS_AUTO, xmirror);
 -                                      ED_object_vgroup_calc_from_armature(reports, scene, ob, par, ARM_GROUPS_AUTO, xmirror);
++                                      ED_object_vgroup_calc_from_armature(reports, &eval_ctx, scene, ob, par, ARM_GROUPS_AUTO, xmirror);
                                        WM_cursor_wait(0);
                                }
                                /* get corrected inverse */
index 3892b7764404c5c247599dc38f28102c94c48f1b,957cb6a7389f248809fbe04acf1fe30ede5f6aa9..a5b9a840c33fa0b25ac9438ccb86b3550e255ed4
@@@ -131,13 -130,9 +131,13 @@@ static int weight_from_bones_exec(bCont
        Mesh *me = ob->data;
        int type = RNA_enum_get(op->ptr, "type");
  
 -      ED_object_vgroup_calc_from_armature(op->reports, scene, ob, armob, type, (me->editflag & ME_EDIT_MIRROR_X));
 +      EvaluationContext eval_ctx;
 +
 +      CTX_data_eval_ctx(C, &eval_ctx);
 +
-       create_vgroups_from_armature(op->reports, &eval_ctx, scene, ob, armob, type, (me->editflag & ME_EDIT_MIRROR_X));
++      ED_object_vgroup_calc_from_armature(op->reports, &eval_ctx, scene, ob, armob, type, (me->editflag & ME_EDIT_MIRROR_X));
  
 -      DAG_id_tag_update(&me->id, 0);
 +      DEG_id_tag_update(&me->id, 0);
        WM_event_add_notifier(C, NC_GEOM | ND_DATA, me);
  
        return OPERATOR_FINISHED;
index 2f44420f3b723d5b104dbdbba18ad7a68fbb9dde,0b8724b4e28ac9a5229ca88e4879fa2b2cc5bd20..9ddaf6d7642be51510028d0fd275125d507c1ae0
@@@ -575,8 -622,8 +575,8 @@@ static eOLDrawState tree_element_active
        if (set != OL_SETSEL_NONE) {
                if (set == OL_SETSEL_NORMAL) {
                        if (!(ebone->flag & BONE_HIDDEN_A)) {
-                               ED_armature_deselect_all(obedit);
 -                              ED_armature_edit_deselect_all(scene->obedit);
 -                              tree_element_active_ebone__sel(C, scene, arm, ebone, true);
++                              ED_armature_edit_deselect_all(obedit);
 +                              tree_element_active_ebone__sel(C, obedit, arm, ebone, true);
                                status = OL_DRAWSEL_NORMAL;
                        }
                }
index be8e63dffe6e77f2e412ee015b4fa26c2f435135,22ca3beae0a2b4e8a8f7a54f989ecb1c9ecf3f76..71ec7bf700c1a98e1fe8e17099f3d54fbaf128bc
@@@ -1500,7 -1514,9 +1500,7 @@@ static bool ed_object_select_pick
                                                }
                                        }
                                }
-                               else if (ED_do_pose_selectbuffer(view_layer, basact, buffer, hits, extend, deselect, toggle, do_nearest)) {
 -                              else if (ED_armature_pose_select_pick_with_buffer(
 -                                               scene, basact, buffer, hits, extend, deselect, toggle, do_nearest))
 -                              {
++                              else if (ED_armature_pose_select_pick_with_buffer(view_layer, basact, buffer, hits, extend, deselect, toggle, do_nearest)) {
                                        /* then bone is found */
                                
                                        /* we make the armature selected: 
@@@ -2044,19 -2033,12 +2044,19 @@@ static int do_object_pose_box_select(bC
        if (hits > 0) { /* no need to loop if there's no hit */
                Base *base;
                col = vbuffer + 3;
 -              
 -              for (base = vc->scene->base.first; base && hits; base = base->next) {
 -                      if (BASE_SELECTABLE(vc->v3d, base)) {
 -                              while (base->selcol == (*col & 0xFFFF)) {   /* we got an object */
 +
 +              /* The draw order doesn't always match the order we populate the engine, see: T51695. */
 +              qsort(vbuffer, hits, sizeof(uint[4]), opengl_select_buffer_cmp);
 +
 +              /*
 +               * Even though 'DRW_draw_select_loop' uses 'DEG_OBJECT_ITER_BEGIN',
 +               * we can be sure the order remains the same between both.
 +               */
 +              for (base = vc->view_layer->object_bases.first; base && hits; base = base->next) {
 +                      if (BASE_SELECTABLE(base)) {
 +                              while (base->object->select_color == (*col & 0xFFFF)) {   /* we got an object */
                                        if (*col & 0xFFFF0000) {                    /* we got a bone */
-                                               bone = get_indexed_bone(base->object, *col & ~(BONESEL_ANY));
+                                               bone = ED_armature_bone_find_index(base->object, *col & ~(BONESEL_ANY));
                                                if (bone) {
                                                        if (select) {
                                                                if ((bone->flag & BONE_UNSELECTABLE) == 0) {
index 96242c229d19bb7d6b1f3ae5eb5356ee19194357,8dba71a54c38a21d25ad62082558b9c5676947bf..f953f1b89d8ffe9173dea5d0788ab0a5ce652d28
@@@ -604,9 -530,9 +604,9 @@@ float ED_vgroup_vert_weight(struct Obje
  int ED_mesh_mirror_topo_table(struct Object *ob, struct DerivedMesh *dm, char mode) RET_ZERO
  int ED_mesh_mirror_spatial_table(struct Object *ob, struct BMEditMesh *em, struct DerivedMesh *dm, const float co[3], char mode) RET_ZERO
  
- float ED_rollBoneToVector(EditBone *bone, const float new_up_axis[3], const bool axis_only) RET_ZERO
+ float ED_armature_ebone_roll_to_vector(const EditBone *bone, const float new_up_axis[3], const bool axis_only) RET_ZERO
  void ED_space_image_get_size(struct SpaceImage *sima, int *width, int *height) RET_NONE
 -bool ED_space_image_check_show_maskedit(struct Scene *scene, struct SpaceImage *sima) RET_ZERO
 +bool ED_space_image_check_show_maskedit(struct SpaceImage *sima, struct ViewLayer *view_layer) RET_ZERO
  
  bool ED_texture_context_check_world(const struct bContext *C) RET_ZERO
  bool ED_texture_context_check_material(const struct bContext *C) RET_ZERO