svn merge ^/trunk/blender -r47398:47413
authorCampbell Barton <ideasman42@gmail.com>
Mon, 4 Jun 2012 15:28:38 +0000 (15:28 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 4 Jun 2012 15:28:38 +0000 (15:28 +0000)
source/blender/blenkernel/BKE_mesh.h
source/blender/blenkernel/intern/cdderivedmesh.c
source/blender/blenkernel/intern/mesh.c
source/blender/blenloader/intern/readfile.c
source/blender/compositor/nodes/COM_ViewerNode.cpp
source/blender/editors/armature/editarmature.c
source/blender/editors/sculpt_paint/paint_vertex.c
source/blender/editors/space_view3d/view3d_select.c

index 7abec07464701a6f57911c83963bf3eea0a6365e..1878e43f577af754a8f4cd17ae1fa5f5cb804cd8 100644 (file)
@@ -33,6 +33,7 @@
 
 /***/
 
+struct ID;
 struct BoundBox;
 struct DispList;
 struct ListBase;
@@ -150,6 +151,13 @@ void copy_dverts(struct MDeformVert *dst, struct MDeformVert *src, int totvert);
 void BKE_mesh_delete_material_index(struct Mesh *me, short index);
 void BKE_mesh_smooth_flag_set(struct Object *meshOb, int enableSmooth);
 void BKE_mesh_convert_mfaces_to_mpolys(struct Mesh *mesh);
+void BKE_mesh_convert_mfaces_to_mpolys_ex(struct ID *id,
+                                          struct CustomData *fdata, struct CustomData *ldata, struct CustomData *pdata,
+                                          int totedge_i, int totface_i, int totloop_i, int totpoly_i,
+                                          struct MEdge *medge, struct MFace *mface,
+                                                                                 int *totloop_r, int *totpoly_r,
+                                                                                 struct MLoop **mloop_r, struct MPoly **mpoly_r);
+
 void BKE_mesh_calc_normals_tessface(struct MVert *mverts, int numVerts, struct MFace *mfaces, int numFaces, float (*faceNors_r)[3]);
 
 /* used for unit testing; compares two meshes, checking only
index 4e6a4b4a43cc044dcf3fc154f312066ed3f247f1..e5e73061d5296000983c096fe59bce830c1d1df1 100644 (file)
@@ -2594,94 +2594,15 @@ MPoly *CDDM_get_polys(DerivedMesh *dm)
 
 void CDDM_tessfaces_to_faces(DerivedMesh *dm)
 {
-       /*converts mfaces to mpolys/mloops*/
+       /* converts mfaces to mpolys/mloops */
        CDDerivedMesh *cddm = (CDDerivedMesh *)dm;
-       MFace *mf;
-       MEdge *me;
-       EdgeHash *eh = BLI_edgehash_new();
-       int i, totloop;
 
-       /* ... on second thaughts, better comment this and assume caller knows edge state. */
-#if 0
-       /* ensure we have all the edges we need */
-       CDDM_calc_edges_tessface(dm);
-#else
-#  ifndef NDEBUG
-       {
-               /* ensure we have correct edges on non release builds */
-               i = cddm->dm.numEdgeData;
-               CDDM_calc_edges_tessface(dm);
-               BLI_assert(cddm->dm.numEdgeData == i);
-       }
-#  endif
-#endif
-
-       /*build edge hash*/
-       me = cddm->medge;
-       for (i = 0; i < cddm->dm.numEdgeData; i++, me++) {
-               BLI_edgehash_insert(eh, me->v1, me->v2, SET_INT_IN_POINTER(i));
-       }
-
-       mf = cddm->mface;
-       totloop = 0;
-       for (i = 0; i < cddm->dm.numTessFaceData; i++, mf++) {
-               totloop += mf->v4 ? 4 : 3;
-       }
-
-       CustomData_free(&cddm->dm.polyData, cddm->dm.numPolyData);
-       CustomData_free(&cddm->dm.loopData, cddm->dm.numLoopData);
-       
-       cddm->dm.numLoopData = totloop;
-       cddm->dm.numPolyData = cddm->dm.numTessFaceData;
-
-       if (totloop) {
-               MLoop *ml;
-               MPoly *mp;
-               int l, *polyindex;
-
-               cddm->mloop = MEM_callocN(sizeof(MLoop) * totloop, "cddm->mloop in CDDM_tessfaces_to_faces");
-               cddm->mpoly = MEM_callocN(sizeof(MPoly) * cddm->dm.numTessFaceData, "cddm->mpoly in CDDM_tessfaces_to_faces");
-
-               CustomData_add_layer(&cddm->dm.loopData, CD_MLOOP, CD_ASSIGN, cddm->mloop, totloop);
-               CustomData_add_layer(&cddm->dm.polyData, CD_MPOLY, CD_ASSIGN, cddm->mpoly, cddm->dm.numPolyData);
-               CustomData_merge(&cddm->dm.faceData, &cddm->dm.polyData,
-                                CD_MASK_ORIGINDEX, CD_DUPLICATE, cddm->dm.numTessFaceData);
-
-               polyindex = CustomData_get_layer(&cddm->dm.faceData, CD_POLYINDEX);
-
-               mf = cddm->mface;
-               mp = cddm->mpoly;
-               ml = cddm->mloop;
-               l = 0;
-               for (i = 0; i < cddm->dm.numTessFaceData; i++, mf++, mp++, polyindex++) {
-                       mp->flag = mf->flag;
-                       mp->loopstart = l;
-                       mp->mat_nr = mf->mat_nr;
-                       mp->totloop = mf->v4 ? 4 : 3;
-
-                       ml->v = mf->v1;
-                       ml->e = GET_INT_FROM_POINTER(BLI_edgehash_lookup(eh, mf->v1, mf->v2));
-                       ml++, l++;
-
-                       ml->v = mf->v2;
-                       ml->e = GET_INT_FROM_POINTER(BLI_edgehash_lookup(eh, mf->v2, mf->v3));
-                       ml++, l++;
-
-                       ml->v = mf->v3;
-                       ml->e = GET_INT_FROM_POINTER(BLI_edgehash_lookup(eh, mf->v3, mf->v4 ? mf->v4 : mf->v1));
-                       ml++, l++;
-
-                       if (mf->v4) {
-                               ml->v = mf->v4;
-                               ml->e = GET_INT_FROM_POINTER(BLI_edgehash_lookup(eh, mf->v4, mf->v1));
-                               ml++, l++;
-                       }
-
-                       *polyindex = i;
-               }
-       }
-
-       BLI_edgehash_free(eh, NULL);
+       BKE_mesh_convert_mfaces_to_mpolys_ex(NULL, &cddm->dm.faceData, &cddm->dm.loopData, &cddm->dm.polyData,
+                                            cddm->dm.numEdgeData, cddm->dm.numTessFaceData,
+                                            cddm->dm.numLoopData, cddm->dm.numPolyData,
+                                            cddm->medge, cddm->mface,
+                                            &cddm->dm.numLoopData, &cddm->dm.numPolyData,
+                                            &cddm->mloop, &cddm->mpoly);
 }
 
 void CDDM_set_mvert(DerivedMesh *dm, MVert *mvert)
index fd952b7b518dda1d4fe8ea47caaa0f9829d3ffa1..5db565d343cf786f6c7faa655afd62034e830312 100644 (file)
@@ -1946,8 +1946,8 @@ void BKE_mesh_calc_normals_tessface(MVert *mverts, int numVerts, MFace *mfaces,
                MEM_freeN(fnors);
 }
 
-
-static void bm_corners_to_loops(Mesh *me, int findex, int loopstart, int numTex, int numCol)
+static void bm_corners_to_loops_ex(ID *id, CustomData *fdata, CustomData *ldata, CustomData *pdata,
+                                   MFace *mface, int totloop, int findex, int loopstart, int numTex, int numCol)
 {
        MTFace *texface;
        MTexPoly *texpoly;
@@ -1957,15 +1957,15 @@ static void bm_corners_to_loops(Mesh *me, int findex, int loopstart, int numTex,
        MFace *mf;
        int i;
 
-       mf = me->mface + findex;
+       mf = mface + findex;
 
        for (i = 0; i < numTex; i++) {
-               texface = CustomData_get_n(&me->fdata, CD_MTFACE, findex, i);
-               texpoly = CustomData_get_n(&me->pdata, CD_MTEXPOLY, findex, i); 
-               
+               texface = CustomData_get_n(fdata, CD_MTFACE, findex, i);
+               texpoly = CustomData_get_n(pdata, CD_MTEXPOLY, findex, i);
+
                ME_MTEXFACE_CPY(texpoly, texface);
-       
-               mloopuv = CustomData_get_n(&me->ldata, CD_MLOOPUV, loopstart, i);
+
+               mloopuv = CustomData_get_n(ldata, CD_MLOOPUV, loopstart, i);
                copy_v2_v2(mloopuv->uv, texface->uv[0]); mloopuv++;
                copy_v2_v2(mloopuv->uv, texface->uv[1]); mloopuv++;
                copy_v2_v2(mloopuv->uv, texface->uv[2]); mloopuv++;
@@ -1976,8 +1976,8 @@ static void bm_corners_to_loops(Mesh *me, int findex, int loopstart, int numTex,
        }
 
        for (i = 0; i < numCol; i++) {
-               mloopcol = CustomData_get_n(&me->ldata, CD_MLOOPCOL, loopstart, i);
-               mcol = CustomData_get_n(&me->fdata, CD_MCOL, findex, i);
+               mloopcol = CustomData_get_n(ldata, CD_MLOOPCOL, loopstart, i);
+               mcol = CustomData_get_n(fdata, CD_MCOL, findex, i);
 
                MESH_MLOOPCOL_FROM_MCOL(mloopcol, &mcol[0]); mloopcol++;
                MESH_MLOOPCOL_FROM_MCOL(mloopcol, &mcol[1]); mloopcol++;
@@ -1986,21 +1986,23 @@ static void bm_corners_to_loops(Mesh *me, int findex, int loopstart, int numTex,
                        MESH_MLOOPCOL_FROM_MCOL(mloopcol, &mcol[3]); mloopcol++;
                }
        }
-       
-       if (CustomData_has_layer(&me->fdata, CD_MDISPS)) {
-               MDisps *ld = CustomData_get(&me->ldata, loopstart, CD_MDISPS);
-               MDisps *fd = CustomData_get(&me->fdata, findex, CD_MDISPS);
+
+       if (CustomData_has_layer(fdata, CD_MDISPS)) {
+               MDisps *ld = CustomData_get(ldata, loopstart, CD_MDISPS);
+               MDisps *fd = CustomData_get(fdata, findex, CD_MDISPS);
                float (*disps)[3] = fd->disps;
                int i, tot = mf->v4 ? 4 : 3;
                int side, corners;
 
-               if (CustomData_external_test(&me->fdata, CD_MDISPS)) {
-                       CustomData_external_add(&me->ldata, &me->id, CD_MDISPS,
-                                               me->totloop, me->fdata.external->filename);
+               if (CustomData_external_test(fdata, CD_MDISPS)) {
+                       if (id) {
+                               CustomData_external_add(ldata, id, CD_MDISPS,
+                                                       totloop, fdata->external->filename);
+                       }
                }
-               
+
                corners = multires_mdisp_corners(fd);
-               
+
                if (corners == 0) {
                        /* Empty MDisp layers appear in at least one of the sintel.blend files.
                         * Not sure why this happens, but it seems fine to just ignore them here.
@@ -2009,14 +2011,14 @@ static void bm_corners_to_loops(Mesh *me, int findex, int loopstart, int numTex,
                }
                else {
                        side = sqrt(fd->totdisp / corners);
-               
+
                        for (i = 0; i < tot; i++, disps += side * side, ld++) {
                                ld->totdisp = side * side;
                                ld->level = (int)(logf(side - 1.0f) / (float)M_LN2) + 1;
-                       
+
                                if (ld->disps)
                                        MEM_freeN(ld->disps);
-                       
+
                                ld->disps = MEM_callocN(sizeof(float) * 3 * side * side, "converted loop mdisps");
                                if (fd->disps) {
                                        memcpy(ld->disps, disps, sizeof(float) * 3 * side * side);
@@ -2027,71 +2029,88 @@ static void bm_corners_to_loops(Mesh *me, int findex, int loopstart, int numTex,
 }
 
 void BKE_mesh_convert_mfaces_to_mpolys(Mesh *mesh)
+{
+       BKE_mesh_convert_mfaces_to_mpolys_ex(&mesh->id, &mesh->fdata, &mesh->ldata, &mesh->pdata,
+                                            mesh->totedge, mesh->totface, mesh->totloop, mesh->totpoly,
+                                            mesh->medge, mesh->mface,
+                                            &mesh->totloop, &mesh->totpoly, &mesh->mloop, &mesh->mpoly);
+
+       mesh_update_customdata_pointers(mesh, TRUE);
+}
+
+void BKE_mesh_convert_mfaces_to_mpolys_ex(ID *id, CustomData *fdata, CustomData *ldata, CustomData *pdata,
+                                          int totedge_i, int totface_i, int totloop_i, int totpoly_i,
+                                          MEdge *medge, MFace *mface,
+                                                                                 int *totloop_r, int *totpoly_r,
+                                                                                 MLoop **mloop_r, MPoly **mpoly_r)
 {
        MFace *mf;
-       MLoop *ml;
-       MPoly *mp;
+       MLoop *ml, *mloop;
+       MPoly *mp, *mpoly;
        MEdge *me;
        EdgeHash *eh;
        int numTex, numCol;
-       int i, j, totloop;
+       int i, j, totloop, totpoly, *polyindex;
 
        /* just in case some of these layers are filled in (can happen with python created meshes) */
-       CustomData_free(&mesh->ldata, mesh->totloop);
-       CustomData_free(&mesh->pdata, mesh->totpoly);
-       memset(&mesh->ldata, 0, sizeof(mesh->ldata));
-       memset(&mesh->pdata, 0, sizeof(mesh->pdata));
+       CustomData_free(ldata, totloop_i);
+       CustomData_free(pdata, totpoly_i);
+       memset(ldata, 0, sizeof(*ldata));
+       memset(pdata, 0, sizeof(*pdata));
 
-       mesh->totpoly = mesh->totface;
-       mesh->mpoly = MEM_callocN(sizeof(MPoly) * mesh->totpoly, "mpoly converted");
-       CustomData_add_layer(&mesh->pdata, CD_MPOLY, CD_ASSIGN, mesh->mpoly, mesh->totpoly);
+       totpoly = totface_i;
+       mpoly = MEM_callocN(sizeof(MPoly) * totpoly, "mpoly converted");
+       CustomData_add_layer(pdata, CD_MPOLY, CD_ASSIGN, mpoly, totpoly);
+
+       numTex = CustomData_number_of_layers(fdata, CD_MTFACE);
+       numCol = CustomData_number_of_layers(fdata, CD_MCOL);
 
-       numTex = CustomData_number_of_layers(&mesh->fdata, CD_MTFACE);
-       numCol = CustomData_number_of_layers(&mesh->fdata, CD_MCOL);
-       
        totloop = 0;
-       mf = mesh->mface;
-       for (i = 0; i < mesh->totface; i++, mf++) {
+       mf = mface;
+       for (i = 0; i < totface_i; i++, mf++) {
                totloop += mf->v4 ? 4 : 3;
        }
-       
-       mesh->totloop = totloop;
-       mesh->mloop = MEM_callocN(sizeof(MLoop) * mesh->totloop, "mloop converted");
 
-       CustomData_add_layer(&mesh->ldata, CD_MLOOP, CD_ASSIGN, mesh->mloop, totloop);
-       CustomData_to_bmeshpoly(&mesh->fdata, &mesh->pdata, &mesh->ldata,
-                               mesh->totloop, mesh->totpoly);
+       mloop = MEM_callocN(sizeof(MLoop) * totloop, "mloop converted");
 
-       /* ensure external data is transferred */
-       CustomData_external_read(&mesh->fdata, &mesh->id, CD_MASK_MDISPS, mesh->totface);
+       CustomData_add_layer(ldata, CD_MLOOP, CD_ASSIGN, mloop, totloop);
+
+       CustomData_to_bmeshpoly(fdata, pdata, ldata, totloop, totpoly);
+
+       if (id) {
+               /* ensure external data is transferred */
+               CustomData_external_read(fdata, id, CD_MASK_MDISPS, totface_i);
+       }
 
        eh = BLI_edgehash_new();
 
-       /*build edge hash*/
-       me = mesh->medge;
-       for (i = 0; i < mesh->totedge; i++, me++) {
+       /* build edge hash */
+       me = medge;
+       for (i = 0; i < totedge_i; i++, me++) {
                BLI_edgehash_insert(eh, me->v1, me->v2, SET_INT_IN_POINTER(i));
 
                /* unrelated but avoid having the FGON flag enabled, so we can reuse it later for something else */
                me->flag &= ~ME_FGON;
        }
 
-       j = 0; /*current loop index*/
-       ml = mesh->mloop;
-       mf = mesh->mface;
-       mp = mesh->mpoly;
-       for (i = 0; i < mesh->totface; i++, mf++, mp++) {
+       polyindex = CustomData_get_layer(fdata, CD_POLYINDEX);
+
+       j = 0; /* current loop index */
+       ml = mloop;
+       mf = mface;
+       mp = mpoly;
+       for (i = 0; i < totface_i; i++, mf++, mp++) {
                mp->loopstart = j;
-               
+
                mp->totloop = mf->v4 ? 4 : 3;
 
                mp->mat_nr = mf->mat_nr;
                mp->flag = mf->flag;
-               
+
 #       define ML(v1, v2) { \
                        ml->v = mf->v1; ml->e = GET_INT_FROM_POINTER(BLI_edgehash_lookup(eh, mf->v1, mf->v2)); ml++; j++; \
                } (void)0
-               
+
                ML(v1, v2);
                ML(v2, v3);
                if (mf->v4) {
@@ -2101,18 +2120,26 @@ void BKE_mesh_convert_mfaces_to_mpolys(Mesh *mesh)
                else {
                        ML(v3, v1);
                }
-               
+
 #       undef ML
 
-               bm_corners_to_loops(mesh, i, mp->loopstart, numTex, numCol);
+               bm_corners_to_loops_ex(id, fdata, ldata, pdata, mface, totloop, i, mp->loopstart, numTex, numCol);
+
+               if (polyindex) {
+                       *polyindex = i;
+                       polyindex++;
+               }
        }
 
        /* note, we don't convert FGons at all, these are not even real ngons,
         * they have their own UV's, colors etc - its more an editing feature. */
 
-       mesh_update_customdata_pointers(mesh, TRUE);
-
        BLI_edgehash_free(eh, NULL);
+
+       *totpoly_r = totpoly;
+       *totloop_r = totloop;
+       *mpoly_r = mpoly;
+       *mloop_r = mloop;
 }
 
 float (*mesh_getVertexCos(Mesh * me, int *numVerts_r))[3]
index 23939cc1aae4ec4bd560dfd85f2e2a24b7a51dcc..70bcf6c758ec51204e4133971681589165db3f45 100644 (file)
@@ -8004,10 +8004,17 @@ static void expand_doit(FileData *fd, Main *mainvar, void *old)
                                        
                                        /* Update: the issue is that in file reading, the oldnewmap is OK, but for existing data, it has to be
                                         * inserted in the map to be found! */
-                                       if (id->flag & LIB_PRE_EXISTING)
-                                               oldnewmap_insert(fd->libmap, bhead->old, id, 1);
-                                       
+
+                                       /* Update: previously it was checking for id->flag & LIB_PRE_EXISTING, however that does not affect file
+                                        * reading. For file reading we may need to insert it into the libmap as well, because you might have
+                                        * two files indirectly linking the same datablock, and in that case we need this in the libmap for the
+                                        * fd of both those files.
+                                        *
+                                        * The crash that this check avoided earlier was because bhead->code wasn't properly passed in, making
+                                        * change_idid_adr not detect the mapping was for an ID_ID datablock. */
+                                       oldnewmap_insert(fd->libmap, bhead->old, id, bhead->code);
                                        change_idid_adr_fd(fd, bhead->old, id);
+                                       
                                        // commented because this can print way too much
                                        // if (G.debug & G_DEBUG) printf("expand_doit: already linked: %s lib: %s\n", id->name, lib->name);
                                }
@@ -8023,7 +8030,7 @@ static void expand_doit(FileData *fd, Main *mainvar, void *old)
                        else {
                                /* this is actually only needed on UI call? when ID was already read before, and another append
                                 * happens which invokes same ID... in that case the lookup table needs this entry */
-                               oldnewmap_insert(fd->libmap, bhead->old, id, 1);
+                               oldnewmap_insert(fd->libmap, bhead->old, id, bhead->code);
                                // commented because this can print way too much
                                // if (G.debug & G_DEBUG) printf("expand: already read %s\n", id->name);
                        }
@@ -8908,7 +8915,7 @@ static ID *append_named_part(Main *mainl, FileData *fd, const char *idname, cons
                                else {
                                        /* already linked */
                                        printf("append: already linked\n");
-                                       oldnewmap_insert(fd->libmap, bhead->old, id, 1);
+                                       oldnewmap_insert(fd->libmap, bhead->old, id, bhead->code);
                                        if (id->flag & LIB_INDIRECT) {
                                                id->flag -= LIB_INDIRECT;
                                                id->flag |= LIB_EXTERN;
index 3282929af523209a7071a492aa3052930e8f3e05..db4fd115d734072b615bada2cbc6523eace7c070 100644 (file)
@@ -36,8 +36,8 @@ void ViewerNode::convertToOperations(ExecutionSystem *graph, CompositorContext *
        InputSocket *alphaSocket = this->getInputSocket(1);
        Image *image = (Image*)this->getbNode()->id;
        ImageUser * imageUser = (ImageUser*) this->getbNode()->storage;
-       if (imageSocket->isConnected()) {
-               bNode *editorNode = this->getbNode();
+       bNode *editorNode = this->getbNode();
+       if (imageSocket->isConnected() && (editorNode->flag & NODE_DO_OUTPUT)) {
                ViewerOperation *viewerOperation = new ViewerOperation();
                viewerOperation->setColorManagement(context->getScene()->r.color_mgt_flag & R_COLOR_MANAGEMENT);
                viewerOperation->setColorPredivide(context->getScene()->r.color_mgt_flag & R_COLOR_MANAGEMENT_PREDIVIDE);
index fdebddbf41d20aacf9139a8c06cf9dbffbf26075..48743c68ff51a25ead4d99b44b7cbd61980f9685 100644 (file)
@@ -2297,7 +2297,7 @@ void add_primitive_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d)
        
        ED_armature_deselect_all(obedit, 0);
        
-       /*      Create a bone   */
+       /* Create a bone */
        bone = ED_armature_edit_bone_add(arm, "Bone");
 
        arm->act_edbone = bone;
@@ -2308,7 +2308,6 @@ void add_primitive_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d)
                add_v3_v3v3(bone->tail, bone->head, imat[1]);   // bone with unit length 1
        else
                add_v3_v3v3(bone->tail, bone->head, imat[2]);   // bone with unit length 1, pointing up Z
-       
 }
 
 
@@ -4528,9 +4527,6 @@ int ED_do_pose_selectbuffer(Scene *scene, Base *base, unsigned int *buffer, shor
                        ED_pose_deselectall(ob, 0);
                        nearBone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
                        arm->act_bone = nearBone;
-                       
-                       // XXX old cruft! use notifiers instead
-                       //select_actionchannel_by_name(ob->action, nearBone->name, 1);
                }
                else {
                        if (extend) {
@@ -4548,17 +4544,11 @@ int ED_do_pose_selectbuffer(Scene *scene, Base *base, unsigned int *buffer, shor
                                        }
                                        else {
                                                nearBone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
-                                       
-                                               // XXX old cruft! use notifiers instead
-                                               //select_actionchannel_by_name(ob->action, nearBone->name, 0);
                                        }
                                }
                                else {
                                        nearBone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
                                        arm->act_bone = nearBone;
-                               
-                                       // XXX old cruft! use notifiers instead
-                                       //select_actionchannel_by_name(ob->action, nearBone->name, 1);
                                }
                        }       
                }
index eb79989b90b6a0e192bc825bbfcc6b72e70a8985..43981770784dc24f2eb417a954d251211dcb1f9b 100644 (file)
@@ -2461,6 +2461,8 @@ static void wpaint_stroke_done(const bContext *C, struct PaintStroke *stroke)
        }
        
        DAG_id_tag_update(ob->data, 0);
+
+       WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
 }
 
 
@@ -2954,6 +2956,8 @@ static void vpaint_stroke_done(const bContext *C, struct PaintStroke *stroke)
 {
        ToolSettings *ts = CTX_data_tool_settings(C);
        struct VPaintData *vpd = paint_stroke_mode_data(stroke);
+       ViewContext *vc = &vpd->vc;
+       Object *ob = vc->obact;
        
        if (vpd->vertexcosnos)
                MEM_freeN(vpd->vertexcosnos);
@@ -2966,6 +2970,8 @@ static void vpaint_stroke_done(const bContext *C, struct PaintStroke *stroke)
                BLI_memarena_free(vpd->polyfacemap_arena);
        }
 
+       WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
+
        MEM_freeN(vpd);
 }
 
index 602f790c8dfde054ee3c3f78f1ab9819efc707d0..d2f2fdcaa8130ef8d7499b8306d823757b8ed5dd 100644 (file)
@@ -1870,7 +1870,6 @@ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, i
                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 */
-                                       
                                        if (*col & 0xFFFF0000) {                    /* we got a bone */
                                                bone = get_indexed_bone(base->object, *col & ~(BONESEL_ANY));
                                                if (bone) {
@@ -1878,16 +1877,13 @@ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, i
                                                                if ((bone->flag & BONE_UNSELECTABLE) == 0) {
                                                                        bone->flag |= BONE_SELECTED;
                                                                        bone_selected = 1;
-// XXX                                                                 select_actionchannel_by_name(base->object->action, bone->name, 1);
                                                                }
                                                        }
                                                        else {
                                                                bArmature *arm = base->object->data;
                                                                bone->flag &= ~BONE_SELECTED;
-// XXX                                                                 select_actionchannel_by_name(base->object->action, bone->name, 0);
                                                                if (arm->act_bone == bone)
                                                                        arm->act_bone = NULL;
-                                                               
                                                        }
                                                }
                                        }
@@ -1897,7 +1893,7 @@ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, i
                                                else
                                                        ED_base_object_select(base, BA_DESELECT);
                                        }
-
+                                       
                                        col += 4; /* next color */
                                        hits--;
                                        if (hits == 0) break;
@@ -1906,13 +1902,16 @@ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, i
                        
                        if (bone_selected) {
                                Object *ob = base->object;
-                               bArmature *arm = ob->data;
-                               
-                               WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, ob);
                                
-                               if (arm->flag & ARM_HAS_VIZ_DEPS) {
-                                       /* mask modifier ('armature' mode), etc. */
-                                       DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
+                               if (ob && (ob->type == OB_ARMATURE)) {
+                                       bArmature *arm = ob->data;
+                                       
+                                       WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, ob);
+                                       
+                                       if (arm && (arm->flag & ARM_HAS_VIZ_DEPS)) {
+                                               /* mask modifier ('armature' mode), etc. */
+                                               DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
+                                       }
                                }
                        }
                }