diff options
author | Mike Erwin <significant.bit@gmail.com> | 2011-08-02 05:01:56 +0400 |
---|---|---|
committer | Mike Erwin <significant.bit@gmail.com> | 2011-08-02 05:01:56 +0400 |
commit | dc2609da3d08ff2dde1747201ef4e0ebb17d5bd9 (patch) | |
tree | b18b8fa9a8eba6a9de70514def129b53f4733aaa /source/blender | |
parent | 19b38034f989089e359b9a4ea1e65fcbe8ffa18c (diff) | |
parent | c965d1d2ccfd57926476cb5c091afa35c6de217f (diff) |
svn merge -r38814:38905 https://svn.blender.org/svnroot/bf-blender/trunk/blender .merwin-spacenav
Diffstat (limited to 'source/blender')
24 files changed, 262 insertions, 128 deletions
diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h index 0491116d199..557ce417b14 100644 --- a/source/blender/blenkernel/BKE_curve.h +++ b/source/blender/blenkernel/BKE_curve.h @@ -115,5 +115,6 @@ int minmax_curve(struct Curve *cu, float min[3], float max[3]); int curve_center_median(struct Curve *cu, float cent[3]); int curve_center_bounds(struct Curve *cu, float cent[3]); void curve_translate(struct Curve *cu, float offset[3], int do_keys); +void curve_delete_material_index(struct Curve *cu, int index); #endif diff --git a/source/blender/blenkernel/BKE_material.h b/source/blender/blenkernel/BKE_material.h index c445408609c..88965d12e4a 100644 --- a/source/blender/blenkernel/BKE_material.h +++ b/source/blender/blenkernel/BKE_material.h @@ -78,7 +78,7 @@ int object_remove_material_slot(struct Object *ob); /* rna api */ void material_append_id(struct ID *id, struct Material *ma); -struct Material *material_pop_id(struct ID *id, int index); +struct Material *material_pop_id(struct ID *id, int index, int remove_material_slot); /* rendering */ diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index d9c98bc0200..62b8830de20 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -1883,7 +1883,9 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos /* set the DerivedMesh to only copy needed data */ mask= (CustomDataMask)GET_INT_FROM_POINTER(curr->link); - DM_set_only_copy(dm, mask); + /* needMapping check here fixes bug [#28112], otherwise its + * possible that it wont be copied */ + DM_set_only_copy(dm, mask | (needMapping ? CD_MASK_ORIGINDEX : 0)); /* add cloth rest shape key if need */ if(mask & CD_MASK_CLOTH_ORCO) diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 202a3f28d9a..eb364af6ff8 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -580,46 +580,47 @@ void addNurbPointsBezier(Nurb *nu, int number) /* ~~~~~~~~~~~~~~~~~~~~Non Uniform Rational B Spline calculations ~~~~~~~~~~~ */ -static void calcknots(float *knots, short aantal, short order, short type) -/* knots: number of pnts NOT corrected for cyclic */ -/* type; 0: uniform, 1: endpoints, 2: bezier */ +static void calcknots(float *knots, const short pnts, const short order, const short flag) { + /* knots: number of pnts NOT corrected for cyclic */ + const int pnts_order= pnts + order; float k; - int a, t; - - t = aantal+order; - if(type==0) { + int a; - for(a=0;a<t;a++) { - knots[a]= (float)a; - } - } - else if(type==1) { + switch(flag & (CU_NURB_ENDPOINT|CU_NURB_BEZIER)) { + case CU_NURB_ENDPOINT: k= 0.0; - for(a=1;a<=t;a++) { + for(a=1; a <= pnts_order; a++) { knots[a-1]= k; - if(a>=order && a<=aantal) k+= 1.0f; + if(a >= order && a <= pnts) k+= 1.0f; } - } - else if(type==2) { - /* Warning, the order MUST be 2 or 4, if this is not enforced, the displist will be corrupt */ + break; + case CU_NURB_BEZIER: + /* Warning, the order MUST be 2 or 4, + * if this is not enforced, the displist will be corrupt */ if(order==4) { k= 0.34; - for(a=0;a<t;a++) { + for(a=0; a < pnts_order; a++) { knots[a]= floorf(k); k+= (1.0f/3.0f); } } else if(order==3) { k= 0.6f; - for(a=0;a<t;a++) { - if(a>=order && a<=aantal) k+= 0.5f; + for(a=0; a < pnts_order; a++) { + if(a >= order && a <= pnts) k+= 0.5f; knots[a]= floorf(k); } } else { printf("bez nurb curve order is not 3 or 4, should never happen\n"); } + break; + default: + for(a=0; a < pnts_order; a++) { + knots[a]= (float)a; + } + break; } } @@ -662,7 +663,7 @@ static void makeknots(Nurb *nu, short uv) calcknots(nu->knotsu, nu->pntsu, nu->orderu, 0); /* cyclic should be uniform */ makecyclicknots(nu->knotsu, nu->pntsu, nu->orderu); } else { - calcknots(nu->knotsu, nu->pntsu, nu->orderu, nu->flagu>>1); + calcknots(nu->knotsu, nu->pntsu, nu->orderu, nu->flagu); } } else nu->knotsu= NULL; @@ -675,7 +676,7 @@ static void makeknots(Nurb *nu, short uv) calcknots(nu->knotsv, nu->pntsv, nu->orderv, 0); /* cyclic should be uniform */ makecyclicknots(nu->knotsv, nu->pntsv, nu->orderv); } else { - calcknots(nu->knotsv, nu->pntsv, nu->orderv, nu->flagv>>1); + calcknots(nu->knotsv, nu->pntsv, nu->orderv, nu->flagv); } } else nu->knotsv= NULL; @@ -3259,3 +3260,28 @@ void curve_translate(Curve *cu, float offset[3], int do_keys) } } } + +void curve_delete_material_index(Curve *cu, int index) +{ + const int curvetype= curve_type(cu); + + if(curvetype == OB_FONT) { + struct CharInfo *info= cu->strinfo; + int i; + for(i= cu->len-1; i >= 0; i--, info++) { + if (info->mat_nr && info->mat_nr>=index) { + info->mat_nr--; + } + } + } + else { + Nurb *nu; + + for (nu= cu->nurb.first; nu; nu= nu->next) { + if(nu->mat_nr && nu->mat_nr>=index) { + nu->mat_nr--; + if (curvetype == OB_CURVE) nu->charidx--; + } + } + } +} diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index 4f921f005f4..104ce2b3b32 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -518,7 +518,7 @@ static const char *material_adrcodes_to_paths (int adrcode, int *array_index) return "alpha"; case MA_REF: - return "diffuse_reflection"; + return "diffuse_intensity"; case MA_EMIT: return "emit"; @@ -527,7 +527,7 @@ static const char *material_adrcodes_to_paths (int adrcode, int *array_index) return "ambient"; case MA_SPEC: - return "specular_reflection"; + return "specular_intensity"; case MA_HARD: return "specular_hardness"; @@ -551,13 +551,13 @@ static const char *material_adrcodes_to_paths (int adrcode, int *array_index) return "raytrace_mirror.fresnel"; case MA_FRESMIRI: - return "raytrace_mirror.fresnel_fac"; + return "raytrace_mirror.fresnel_factor"; case MA_FRESTRA: return "raytrace_transparency.fresnel"; case MA_FRESTRAI: - return "raytrace_transparency.fresnel_fac"; + return "raytrace_transparency.fresnel_factor"; case MA_ADD: return "halo.add"; diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index 8b0cfb1d156..0964c66fecd 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -474,20 +474,20 @@ static int setkeys(float fac, ListBase *lb, KeyBlock *k[], float *t, int cycl) } -static void flerp(int aantal, float *in, float *f0, float *f1, float *f2, float *f3, float *t) +static void flerp(int tot, float *in, float *f0, float *f1, float *f2, float *f3, float *t) { int a; - for(a=0; a<aantal; a++) { + for(a=0; a<tot; a++) { in[a]= t[0]*f0[a]+t[1]*f1[a]+t[2]*f2[a]+t[3]*f3[a]; } } -static void rel_flerp(int aantal, float *in, float *ref, float *out, float fac) +static void rel_flerp(int tot, float *in, float *ref, float *out, float fac) { int a; - for(a=0; a<aantal; a++) { + for(a=0; a<tot; a++) { in[a]-= fac*(ref[a]-out[a]); } } diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 3f01c55e935..9c455e84109 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -61,7 +61,7 @@ #include "BKE_material.h" #include "BKE_mesh.h" #include "BKE_node.h" - +#include "BKE_curve.h" #include "GPU_material.h" @@ -515,6 +515,21 @@ short *give_totcolp_id(ID *id) return NULL; } +void data_delete_material_index_id(ID *id, int index) +{ + switch(GS(id->name)) { + case ID_ME: + mesh_delete_material_index((Mesh *)id, index); + break; + case ID_CU: + curve_delete_material_index((Curve *)id, index); + break; + case ID_MB: + /* meta-elems dont have materials atm */ + break; + } +} + void material_append_id(ID *id, Material *ma) { Material ***matar; @@ -532,7 +547,7 @@ void material_append_id(ID *id, Material *ma) } } -Material *material_pop_id(ID *id, int index) +Material *material_pop_id(ID *id, int index, int remove_material_slot) { Material *ret= NULL; Material ***matar; @@ -540,27 +555,36 @@ Material *material_pop_id(ID *id, int index) short *totcol= give_totcolp_id(id); if(index >= 0 && index < (*totcol)) { ret= (*matar)[index]; - id_us_min((ID *)ret); - if(*totcol <= 1) { - *totcol= 0; - MEM_freeN(*matar); - *matar= NULL; - } - else { - Material **mat; - - if(index + 1 != (*totcol)) - memmove((*matar)+index, (*matar)+(index+1), sizeof(void *) * ((*totcol) - (index + 1))); + id_us_min((ID *)ret); - (*totcol)--; - - mat= MEM_callocN(sizeof(void *) * (*totcol), "newmatar"); - memcpy(mat, *matar, sizeof(void *) * (*totcol)); - MEM_freeN(*matar); + if (remove_material_slot) { + if(*totcol <= 1) { + *totcol= 0; + MEM_freeN(*matar); + *matar= NULL; + } + else { + Material **mat; + if(index + 1 != (*totcol)) + memmove((*matar)+index, (*matar)+(index+1), sizeof(void *) * ((*totcol) - (index + 1))); + + (*totcol)--; + + mat= MEM_callocN(sizeof(void *) * (*totcol), "newmatar"); + memcpy(mat, *matar, sizeof(void *) * (*totcol)); + MEM_freeN(*matar); + + *matar= mat; + test_object_materials(id); + } - *matar= mat; - test_object_materials(id); + /* decrease mat_nr index */ + data_delete_material_index_id(id, index); } + + /* don't remove material slot, only clear it*/ + else + (*matar)[index]= NULL; } } @@ -1025,8 +1049,6 @@ int object_remove_material_slot(Object *ob) { Material *mao, ***matarar; Object *obt; - Curve *cu; - Nurb *nu; short *totcolp; int a, actcol; @@ -1086,23 +1108,8 @@ int object_remove_material_slot(Object *ob) } /* check indices from mesh */ - - if(ob->type==OB_MESH) { - Mesh *me= get_mesh(ob); - mesh_delete_material_index(me, actcol-1); - freedisplist(&ob->disp); - } - else if ELEM(ob->type, OB_CURVE, OB_SURF) { - cu= ob->data; - nu= cu->nurb.first; - - while(nu) { - if(nu->mat_nr && nu->mat_nr>=actcol-1) { - nu->mat_nr--; - if (ob->type == OB_CURVE) nu->charidx--; - } - nu= nu->next; - } + if (ELEM4(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT)) { + data_delete_material_index_id((ID *)ob->data, actcol-1); freedisplist(&ob->disp); } diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 45a60b842a7..32819226361 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -1254,10 +1254,10 @@ void mesh_to_curve(Scene *scene, Object *ob) void mesh_delete_material_index(Mesh *me, int index) { + MFace *mf; int i; - for (i=0; i<me->totface; i++) { - MFace *mf = &((MFace*) me->mface)[i]; + for (i=0, mf=me->mface; i<me->totface; i++, mf++) { if (mf->mat_nr && mf->mat_nr>=index) mf->mat_nr--; } diff --git a/source/blender/blenlib/intern/BLI_args.c b/source/blender/blenlib/intern/BLI_args.c index 7bc93a3d3a0..5f31565d65b 100644 --- a/source/blender/blenlib/intern/BLI_args.c +++ b/source/blender/blenlib/intern/BLI_args.c @@ -290,8 +290,10 @@ void BLI_argsParse(struct bArgs *ba, int pass, BA_ArgCallback default_cb, void * } i += retval; } else if (retval == -1){ - if (a->key->pass != -1) - ba->passes[i] = pass; + if (a) { + if (a->key->pass != -1) + ba->passes[i] = pass; + } break; } } diff --git a/source/blender/blenlib/intern/pbvh.c b/source/blender/blenlib/intern/pbvh.c index 85d79ae3b85..0613765b868 100644 --- a/source/blender/blenlib/intern/pbvh.c +++ b/source/blender/blenlib/intern/pbvh.c @@ -26,7 +26,6 @@ - #include "DNA_meshdata_types.h" #include "MEM_guardedalloc.h" @@ -85,25 +84,61 @@ struct PBVHNode { /* Opaque handle for drawing code */ void *draw_buffers; - int *vert_indices; - /* Voxel bounds */ BB vb; BB orig_vb; - /* For internal nodes */ + /* For internal nodes, the offset of the children in the PBVH + 'nodes' array. */ int children_offset; - /* Pointer into bvh prim_indices */ - int *prim_indices; - int *face_vert_indices; + /* Pointer into the PBVH prim_indices array and the number of + primitives used by this leaf node. + Used for leaf nodes in both mesh- and multires-based PBVHs. + */ + int *prim_indices; unsigned int totprim; + + /* Array of indices into the mesh's MVert array. Contains the + indices of all vertices used by faces that are within this + node's bounding box. + + Note that a vertex might be used by a multiple faces, and + these faces might be in different leaf nodes. Such a vertex + will appear in the vert_indices array of each of those leaf + nodes. + + In order to support cases where you want access to multiple + nodes' vertices without duplication, the vert_indices array + is ordered such that the first part of the array, up to + index 'uniq_verts', contains "unique" vertex indices. These + vertices might not be truly unique to this node, but if + they appear in another node's vert_indices array, they will + be above that node's 'uniq_verts' value. + + Used for leaf nodes in a mesh-based PBVH (not multires.) + */ + int *vert_indices; unsigned int uniq_verts, face_verts; - char flag; + /* An array mapping face corners into the vert_indices + array. The array is sized to match 'totprim', and each of + the face's corners gets an index into the vert_indices + array, in the same order as the corners in the original + MFace. The fourth value should not be used if the original + face is a triangle. + + Used for leaf nodes in a mesh-based PBVH (not multires.) + */ + int (*face_vert_indices)[4]; + + /* Indicates whether this node is a leaf or not; also used for + marking various updates that need to be applied. */ + PBVHNodeFlags flag : 8; - float tmin; // used for raycasting, is how close bb is to the ray point + /* Used for raycasting: how close bb is to the ray point. */ + float tmin; int proxy_count; PBVHProxyNode* proxies; @@ -339,15 +374,15 @@ static void build_mesh_leaf_node(PBVH *bvh, PBVHNode *node) node->uniq_verts = node->face_verts = 0; totface= node->totprim; - node->face_vert_indices = MEM_callocN(sizeof(int) * - 4*totface, "bvh node face vert indices"); + node->face_vert_indices = MEM_callocN(sizeof(int) * 4*totface, + "bvh node face vert indices"); for(i = 0; i < totface; ++i) { MFace *f = bvh->faces + node->prim_indices[i]; int sides = f->v4 ? 4 : 3; for(j = 0; j < sides; ++j) { - node->face_vert_indices[i*4 + j]= + node->face_vert_indices[i][j]= map_insert_vert(bvh, map, &node->face_verts, &node->uniq_verts, (&f->v1)[j]); } @@ -373,9 +408,17 @@ static void build_mesh_leaf_node(PBVH *bvh, PBVHNode *node) BLI_ghashIterator_free(iter); - for(i = 0; i < totface*4; ++i) - if(node->face_vert_indices[i] < 0) - node->face_vert_indices[i]= -node->face_vert_indices[i] + node->uniq_verts - 1; + for(i = 0; i < totface; ++i) { + MFace *f = bvh->faces + node->prim_indices[i]; + int sides = f->v4 ? 4 : 3; + + for(j = 0; j < sides; ++j) { + if(node->face_vert_indices[i][j] < 0) + node->face_vert_indices[i][j]= + -node->face_vert_indices[i][j] + + node->uniq_verts - 1; + } + } if(!G.background) { node->draw_buffers = @@ -1340,20 +1383,20 @@ int BLI_pbvh_node_raycast(PBVH *bvh, PBVHNode *node, float (*origco)[3], if(bvh->faces) { MVert *vert = bvh->verts; int *faces= node->prim_indices; - int *face_verts= node->face_vert_indices; int totface= node->totprim; int i; for(i = 0; i < totface; ++i) { MFace *f = bvh->faces + faces[i]; + int *face_verts = node->face_vert_indices[i]; if(origco) { /* intersect with backuped original coordinates */ hit |= ray_face_intersection(ray_start, ray_normal, - origco[face_verts[i*4+0]], - origco[face_verts[i*4+1]], - origco[face_verts[i*4+2]], - f->v4? origco[face_verts[i*4+3]]: NULL, + origco[face_verts[0]], + origco[face_verts[1]], + origco[face_verts[2]], + f->v4? origco[face_verts[3]]: NULL, dist); } else { diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 4ad99c02b2d..0633794c6ed 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -3162,7 +3162,7 @@ static void lib_link_particlesettings(FileData *fd, Main *main) if(part->effector_weights) part->effector_weights->group = newlibadr(fd, part->id.lib, part->effector_weights->group); - if(part->dupliweights.first) { + if(part->dupliweights.first && part->dup_group) { int index_ok = 0; /* check for old files without indices (all indexes 0) */ dw = part->dupliweights.first; @@ -3193,6 +3193,9 @@ static void lib_link_particlesettings(FileData *fd, Main *main) dw->ob = newlibadr(fd, part->id.lib, dw->ob); } } + else { + part->dupliweights.first = part->dupliweights.last = NULL; + } if(part->boids) { BoidState *state = part->boids->states.first; diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 06d88b16fa8..210f36ca074 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -3432,7 +3432,6 @@ static int convertspline(short type, Nurb *nu) nu->type = CU_NURBS; nu->orderu= 4; nu->flagu &= CU_NURB_CYCLIC; /* disable all flags except for cyclic */ - nu->flagu |= CU_NURB_BEZIER; nurbs_knot_calc_u(nu); a= nu->pntsu*nu->pntsv; bp= nu->bp; @@ -6544,12 +6543,15 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob) BLI_assert(!"invalid nurbs type"); return NULL; } - - /* always do: */ - nu->flag |= CU_SMOOTH; - - test2DNurb(nu); - + + BLI_assert(nu != NULL); + + if(nu) { /* should always be set */ + nu->flag |= CU_SMOOTH; + + test2DNurb(nu); + } + return nu; } diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c index 75e7ee701a2..d9691819b29 100644 --- a/source/blender/editors/interface/interface_anim.c +++ b/source/blender/editors/interface/interface_anim.c @@ -1,3 +1,27 @@ +/* + * $Id$ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): + * + * ***** END GPL LICENSE BLOCK ***** + */ + /** \file blender/editors/interface/interface_anim.c * \ingroup edinterface */ diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index cdc839e084a..16f3789ecb1 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -1,6 +1,3 @@ -/** \file blender/editors/interface/resources.c - * \ingroup edinterface - */ /* * $Id$ * @@ -33,6 +30,10 @@ * ***** END GPL/BL DUAL LICENSE BLOCK ***** */ +/** \file blender/editors/interface/resources.c + * \ingroup edinterface + */ + #include <math.h> #include <stdlib.h> #include <string.h> diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index f21241b6e7a..0fb7cf8b640 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -1096,7 +1096,7 @@ static int move_to_layer_exec(bContext *C, wmOperator *op) Scene *scene= CTX_data_scene(C); View3D *v3d= CTX_wm_view3d(C); unsigned int lay, local; - int islamp= 0; + /* int islamp= 0; */ /* UNUSED */ lay= move_to_layer_init(C, op); lay &= 0xFFFFFF; @@ -1112,7 +1112,7 @@ static int move_to_layer_exec(bContext *C, wmOperator *op) base->object->lay= lay; base->object->flag &= ~SELECT; base->flag &= ~SELECT; - if(base->object->type==OB_LAMP) islamp= 1; + /* if(base->object->type==OB_LAMP) islamp= 1; */ } CTX_DATA_END; } @@ -1124,7 +1124,7 @@ static int move_to_layer_exec(bContext *C, wmOperator *op) local= base->lay & 0xFF000000; base->lay= lay + local; base->object->lay= lay; - if(base->object->type==OB_LAMP) islamp= 1; + /* if(base->object->type==OB_LAMP) islamp= 1; */ } CTX_DATA_END; } diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 68326edfb11..1410331700f 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -301,7 +301,7 @@ int ED_operator_object_active_editable(bContext *C) int ED_operator_object_active_editable_mesh(bContext *C) { Object *ob = ED_object_active_context(C); - return ((ob != NULL) && !(ob->id.lib) && !(ob->restrictflag & OB_RESTRICT_VIEW) && ob->type == OB_MESH); + return ((ob != NULL) && !(ob->id.lib) && !(ob->restrictflag & OB_RESTRICT_VIEW) && ob->type == OB_MESH && !(((ID *)ob->data)->lib)); } int ED_operator_object_active_editable_font(bContext *C) diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index c9a6aa87cd0..32004fd4525 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -2187,7 +2187,7 @@ static int IsectPoly2Df_twoside(const float pt[2], float uv[][2], const int tot) /* One of the most important function for projectiopn painting, since it selects the pixels to be added into each bucket. * initialize pixels from this face where it intersects with the bucket_index, optionally initialize pixels for removing seams */ -static void project_paint_face_init(const ProjPaintState *ps, const int thread_index, const int bucket_index, const int face_index, const int image_index, rctf *bucket_bounds, const ImBuf *ibuf) +static void project_paint_face_init(const ProjPaintState *ps, const int thread_index, const int bucket_index, const int face_index, const int image_index, rctf *bucket_bounds, const ImBuf *ibuf, const short clamp_u, const short clamp_v) { /* Projection vars, to get the 3D locations into screen space */ MemArena *arena = ps->arena_mt[thread_index]; @@ -2304,14 +2304,24 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i if (pixel_bounds_array(uv_clip, &bounds_px, ibuf->x, ibuf->y, uv_clip_tot)) { - + + if(clamp_u) { + CLAMP(bounds_px.xmin, 0, ibuf->x); + CLAMP(bounds_px.xmax, 0, ibuf->x); + } + + if(clamp_v) { + CLAMP(bounds_px.ymin, 0, ibuf->y); + CLAMP(bounds_px.ymax, 0, ibuf->y); + } + /* clip face and */ has_isect = 0; for (y = bounds_px.ymin; y < bounds_px.ymax; y++) { //uv[1] = (((float)y) + 0.5f) / (float)ibuf->y; uv[1] = (float)y / ibuf_yf; /* use pixel offset UV coords instead */ - + has_x_isect = 0; for (x = bounds_px.xmin; x < bounds_px.xmax; x++) { //uv[0] = (((float)x) + 0.5f) / ibuf->x; @@ -2630,6 +2640,7 @@ static void project_bucket_init(const ProjPaintState *ps, const int thread_index LinkNode *node; int face_index, image_index=0; ImBuf *ibuf = NULL; + Image *ima = NULL; MTFace *tf; Image *tpage_last = NULL; @@ -2638,9 +2649,10 @@ static void project_bucket_init(const ProjPaintState *ps, const int thread_index if (ps->image_tot==1) { /* Simple loop, no context switching */ ibuf = ps->projImages[0].ibuf; - + ima = ps->projImages[0].ima; + for (node = ps->bucketFaces[bucket_index]; node; node= node->next) { - project_paint_face_init(ps, thread_index, bucket_index, GET_INT_FROM_POINTER(node->link), 0, bucket_bounds, ibuf); + project_paint_face_init(ps, thread_index, bucket_index, GET_INT_FROM_POINTER(node->link), 0, bucket_bounds, ibuf, ima->tpageflag & IMA_CLAMP_U, ima->tpageflag & IMA_CLAMP_V); } } else { @@ -2659,14 +2671,14 @@ static void project_bucket_init(const ProjPaintState *ps, const int thread_index for (image_index=0; image_index < ps->image_tot; image_index++) { if (ps->projImages[image_index].ima == tpage_last) { ibuf = ps->projImages[image_index].ibuf; + ima = ps->projImages[image_index].ima; break; } } } /* context switching done */ - project_paint_face_init(ps, thread_index, bucket_index, face_index, image_index, bucket_bounds, ibuf); - + project_paint_face_init(ps, thread_index, bucket_index, face_index, image_index, bucket_bounds, ibuf, ima->tpageflag & IMA_CLAMP_U, ima->tpageflag & IMA_CLAMP_V); } } diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index ae80a554e08..5b95ae63e56 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -280,7 +280,8 @@ static char *view3d_modeselect_pup(Scene *scene) str += sprintf(str, formatstr, "Object Mode", OB_MODE_OBJECT, ICON_OBJECT_DATA); - if(ob==NULL) return string; + if(ob==NULL || ob->data==NULL) return string; + if(ob->id.lib || ((ID *)ob->data)->lib) return string; /* if active object is editable */ if ( ((ob->type == OB_MESH) diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 9290e1fc631..c6835b0cad3 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -889,14 +889,14 @@ static unsigned int samplerect(unsigned int *buf, int size, unsigned int dontdo) { Base *base; unsigned int *bufmin,*bufmax; - int a,b,rc,tel,aantal,dirvec[4][2],maxob; + int a,b,rc,tel,len,dirvec[4][2],maxob; unsigned int retval=0; base= LASTBASE; if(base==0) return 0; maxob= base->selcol; - aantal= (size-1)/2; + len= (size-1)/2; rc= 0; dirvec[0][0]= 1; @@ -910,7 +910,7 @@ static unsigned int samplerect(unsigned int *buf, int size, unsigned int dontdo) bufmin= buf; bufmax= buf+ size*size; - buf+= aantal*size+ aantal; + buf+= len*size+ len; for(tel=1;tel<=size;tel++) { diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 7f8d5976e86..92ac8471172 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -4596,7 +4596,7 @@ static int createSlideVerts(TransInfo *t) #define EDGE_SLIDE_MIN 30 if (len_squared_v2v2(start, end) < (EDGE_SLIDE_MIN * EDGE_SLIDE_MIN)) { if(ABS(start[0]-end[0]) + ABS(start[1]-end[1]) < 4.0f) { - /* even more exceptional case, points are ontop of eachother */ + /* even more exceptional case, points are ontop of each other */ end[0]= start[0]; end[1]= start[1] + EDGE_SLIDE_MIN; } diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index 3ce84e3a19f..8d57403ec35 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -35,6 +35,7 @@ #include "DNA_ID.h" #include "DNA_vfont_types.h" +#include "DNA_material_types.h" #include "DNA_object_types.h" #include "WM_types.h" @@ -416,8 +417,9 @@ static void rna_def_ID_materials(BlenderRNA *brna) func= RNA_def_function(srna, "pop", "material_pop_id"); RNA_def_function_ui_description(func, "Remove a material from the data block."); - parm= RNA_def_int(func, "index", 0, 0, INT_MAX, "", "Index of material to remove.", 0, INT_MAX); + parm= RNA_def_int(func, "index", 0, 0, MAXMAT, "", "Index of material to remove.", 0, MAXMAT); RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_boolean(func, "update_data", 0, "", "Update data by re-adjusting the material slots assigned."); parm= RNA_def_pointer(func, "material", "Material", "", "Material to remove."); RNA_def_function_return(func, parm); } diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c index e250cc84aa3..d44b68950f7 100644 --- a/source/blender/makesrna/intern/rna_wm_api.c +++ b/source/blender/makesrna/intern/rna_wm_api.c @@ -205,7 +205,7 @@ void RNA_api_operator(StructRNA *srna) /* check */ func= RNA_def_function(srna, "check", NULL); - RNA_def_function_ui_description(func, "Check the operator settings."); + RNA_def_function_ui_description(func, "Check the operator settings, return True to signal a change to redraw."); RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); parm= RNA_def_pointer(func, "context", "Context", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c index a5d2e0b38c7..922ae8c1e92 100644 --- a/source/blender/modifiers/intern/MOD_uvproject.c +++ b/source/blender/modifiers/intern/MOD_uvproject.c @@ -42,6 +42,7 @@ #include "DNA_object_types.h" #include "BLI_math.h" +#include "BLI_string.h" #include "BLI_uvproject.h" #include "BLI_utildefines.h" @@ -83,6 +84,7 @@ static void copyData(ModifierData *md, ModifierData *target) tumd->aspecty = umd->aspecty; tumd->scalex = umd->scalex; tumd->scaley = umd->scaley; + BLI_strncpy(tumd->uvlayer_name, umd->uvlayer_name, sizeof(umd->uvlayer_name)); } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md)) diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 6e1b9c807f3..502b25842de 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -3262,11 +3262,15 @@ static PyObject *pyrna_prop_dir(BPy_PropertyRNA *self) * */ ret= PyList_New(0); - if (!BPy_PropertyRNA_CheckExact(self)) + if (!BPy_PropertyRNA_CheckExact(self)) { pyrna_dir_members_py(ret, (PyObject *)self); + } - if(RNA_property_collection_type_get(&self->ptr, self->prop, &r_ptr)) - pyrna_dir_members_rna(ret, &r_ptr); + if(RNA_property_type(self->prop) == PROP_COLLECTION) { + if(RNA_property_collection_type_get(&self->ptr, self->prop, &r_ptr)) { + pyrna_dir_members_rna(ret, &r_ptr); + } + } return ret; } @@ -6407,7 +6411,9 @@ PyDoc_STRVAR(pyrna_register_class_doc, " If the class has a *register* class method it will be called\n" " before registration.\n" "\n" -" .. note:: :exc:`ValueError` exception is raised if the class is not a\n" +" .. note::\n" +"\n" +" :exc:`ValueError` exception is raised if the class is not a\n" " subclass of a registerable blender class.\n" "\n" ); |