diff options
Diffstat (limited to 'source')
392 files changed, 5323 insertions, 2295 deletions
diff --git a/source/blender/avi/intern/avi_rgb.c b/source/blender/avi/intern/avi_rgb.c index c6a78eccce2..632ecad61a6 100644 --- a/source/blender/avi/intern/avi_rgb.c +++ b/source/blender/avi/intern/avi_rgb.c @@ -123,13 +123,12 @@ void *avi_converter_to_avi_rgb(AviMovie *movie, int stream, unsigned char *buffe (void)stream; /* unused */ - *size = movie->header->Height * movie->header->Width * 3; - if (movie->header->Width % 2) *size += movie->header->Height; - - buf = MEM_mallocN(*size, "toavirgbbuf"); - rowstride = movie->header->Width * 3; - if (movie->header->Width % 2) rowstride++; + /* AVI files has uncompressed lines 4-byte aligned */ + rowstride = (rowstride + 3) & ~3; + + *size = movie->header->Height * rowstride; + buf = MEM_mallocN(*size, "toavirgbbuf"); for (y = 0; y < movie->header->Height; y++) { memcpy(&buf[y * rowstride], &buffer[((movie->header->Height - 1) - y) * movie->header->Width * 3], movie->header->Width * 3); diff --git a/source/blender/avi/intern/avi_rgb32.c b/source/blender/avi/intern/avi_rgb32.c index 5c7a4889d97..c9cbcb05bb8 100644 --- a/source/blender/avi/intern/avi_rgb32.c +++ b/source/blender/avi/intern/avi_rgb32.c @@ -74,8 +74,8 @@ void *avi_converter_to_rgb32(AviMovie *movie, int stream, unsigned char *buffer, (void)stream; /* unused */ - buf = MEM_mallocN(movie->header->Height * movie->header->Width * 4, "torgb32buf"); *size = movie->header->Height * movie->header->Width * 4; + buf = MEM_mallocN(*size, "torgb32buf"); memset(buf, 255, *size); diff --git a/source/blender/blenkernel/BKE_animsys.h b/source/blender/blenkernel/BKE_animsys.h index 80d2750fe82..e79822daa4d 100644 --- a/source/blender/blenkernel/BKE_animsys.h +++ b/source/blender/blenkernel/BKE_animsys.h @@ -37,8 +37,10 @@ struct Main; struct AnimData; struct KeyingSet; struct KS_Path; +struct bContext; struct PointerRNA; +struct PropertyRNA; struct ReportList; struct bAction; struct bActionGroup; @@ -127,6 +129,9 @@ void BKE_animdata_separate_by_basepath(struct ID *srcID, struct ID *dstID, struc /* Move F-Curves from src to destination if it's path is based on basepath */ void action_move_fcurves_by_basepath(struct bAction *srcAct, struct bAction *dstAct, const char basepath[]); +char *BKE_animdata_driver_path_hack(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, + char *base_path); + /* ************************************* */ /* Batch AnimData API */ diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index 46a0c36a5f2..6c8f90c60ae 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -41,8 +41,8 @@ extern "C" { /* these lines are grep'd, watch out for our not-so-awesome regex * and keep comment above the defines. * Use STRINGIFY() rather than defining with quotes */ -#define BLENDER_VERSION 271 -#define BLENDER_SUBVERSION 6 +#define BLENDER_VERSION 272 +#define BLENDER_SUBVERSION 1 /* 262 was the last editmesh release but it has compatibility code for bmesh data */ #define BLENDER_MINVERSION 270 #define BLENDER_MINSUBVERSION 5 diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h index 5a1e173f0b3..9a6524cc9ab 100644 --- a/source/blender/blenkernel/BKE_customdata.h +++ b/source/blender/blenkernel/BKE_customdata.h @@ -310,7 +310,7 @@ void CustomData_set_layer_flag(struct CustomData *data, int type, int flag); void CustomData_bmesh_set_default(struct CustomData *data, void **block); void CustomData_bmesh_free_block(struct CustomData *data, void **block); -void CustomData_bmesh_free_block_data(struct CustomData *data, void **block); +void CustomData_bmesh_free_block_data(struct CustomData *data, void *block); /* copy custom data to/from layers as in mesh/derivedmesh, to editmesh * blocks of data. the CustomData's must not be compatible */ diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h index 0e86be9b97c..c377769b271 100644 --- a/source/blender/blenkernel/BKE_fcurve.h +++ b/source/blender/blenkernel/BKE_fcurve.h @@ -43,6 +43,7 @@ struct DriverVar; struct DriverTarget; struct FCM_EnvelopeData; +struct bContext; struct bAction; struct BezTriple; struct StructRNA; @@ -221,8 +222,12 @@ struct FCurve *id_data_find_fcurve(ID *id, void *data, struct StructRNA *type, c */ int list_find_data_fcurves(ListBase *dst, ListBase *src, const char *dataPrefix, const char *dataName); -/* find an f-curve based on an rna property */ -struct FCurve *rna_get_fcurve(struct PointerRNA *ptr, struct PropertyRNA *prop, int rnaindex, struct bAction **action, bool *r_driven); +/* find an f-curve based on an rna property. */ +struct FCurve *rna_get_fcurve(struct PointerRNA *ptr, struct PropertyRNA *prop, int rnaindex, + struct bAction **action, bool *r_driven); +/* Same as above, but takes a context data, temp hack needed for complex paths like texture ones. */ +struct FCurve *rna_get_fcurve_context_ui(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, + int rnaindex, struct bAction **action, bool *r_driven); /* Binary search algorithm for finding where to 'insert' BezTriple with given frame number. * Returns the index to insert at (data already at that index will be offset if replace is 0) diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h index 1d37f9e64e1..500c2813a75 100644 --- a/source/blender/blenkernel/BKE_library.h +++ b/source/blender/blenkernel/BKE_library.h @@ -71,8 +71,8 @@ void id_clear_lib_data(struct Main *bmain, struct ID *id); struct ListBase *which_libbase(struct Main *mainlib, short type); -#define MAX_LIBARRAY 43 -int set_listbasepointers(struct Main *main, struct ListBase **lb); +#define MAX_LIBARRAY 35 +int set_listbasepointers(struct Main *main, struct ListBase *lb[MAX_LIBARRAY]); void BKE_libblock_free(struct Main *bmain, void *idv); void BKE_libblock_free_ex(struct Main *bmain, void *idv, bool do_id_user); diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h index a81da8c18af..b080ca37e67 100644 --- a/source/blender/blenkernel/BKE_paint.h +++ b/source/blender/blenkernel/BKE_paint.h @@ -50,6 +50,7 @@ struct PaintCurve; struct Palette; struct PaletteColor; struct PBVH; +struct ReportList; struct Scene; struct Sculpt; struct StrokeCache; @@ -100,7 +101,6 @@ void BKE_paint_set_overlay_override(enum OverlayFlags flag); void BKE_palette_free(struct Palette *palette); struct Palette *BKE_palette_add(struct Main *bmain, const char *name); struct PaletteColor *BKE_palette_color_add(struct Palette *palette); -void BKE_palette_color_delete(struct Palette *palette); bool BKE_palette_is_empty(const struct Palette *palette); void BKE_palette_color_remove(struct Palette *palette, struct PaletteColor *color); void BKE_palette_cleanup(struct Palette *palette); @@ -122,6 +122,9 @@ struct Palette *BKE_paint_palette(struct Paint *paint); void BKE_paint_palette_set(struct Paint *p, struct Palette *palette); void BKE_paint_curve_set(struct Brush *br, struct PaintCurve *pc); +void BKE_paint_data_warning(struct ReportList *reports, bool uvs, bool mat, bool tex, bool stencil); +bool BKE_paint_proj_mesh_data_check(struct Scene *scene, struct Object *ob, bool *uvs, bool *mat, bool *tex, bool *stencil); + /* testing face select mode * Texture paint could be removed since selected faces are not used * however hiding faces is useful */ diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 9ff9991f5a6..81c03d8081b 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -2602,8 +2602,6 @@ static void make_vertexcos__mapFunc(void *userData, int index, const float co[3] void mesh_get_mapped_verts_coords(DerivedMesh *dm, float (*r_cos)[3], const int totcos) { - float (*vertexcos)[3]; - if (dm->foreachMappedVert) { MappedUserData userData; memset(r_cos, 0, sizeof(*r_cos) * totcos); @@ -2615,7 +2613,7 @@ void mesh_get_mapped_verts_coords(DerivedMesh *dm, float (*r_cos)[3], const int else { int i; for (i = 0; i < totcos; i++) { - dm->getVertCo(dm, i, vertexcos[i]); + dm->getVertCo(dm, i, r_cos[i]); } } } diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 5ee82bb5842..2fb832dc72d 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -51,18 +51,23 @@ #include "DNA_material_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" +#include "DNA_screen_types.h" +#include "DNA_space_types.h" #include "DNA_texture_types.h" #include "DNA_world_types.h" #include "BKE_animsys.h" #include "BKE_action.h" +#include "BKE_context.h" #include "BKE_depsgraph.h" #include "BKE_fcurve.h" #include "BKE_nla.h" #include "BKE_global.h" #include "BKE_main.h" +#include "BKE_material.h" #include "BKE_library.h" #include "BKE_report.h" +#include "BKE_texture.h" #include "RNA_access.h" @@ -551,6 +556,74 @@ void BKE_animdata_separate_by_basepath(ID *srcID, ID *dstID, ListBase *basepaths } } +/** + * Temporary wrapper for driver operators for buttons to make it easier to create + * such drivers by rerouting all paths through the active object instead so that + * they will get picked up by the dependency system. + * + * \param C Context pointer - for getting active data + * \param[in,out] ptr RNA pointer for property's datablock. May be modified as result of path remapping. + * \param prop RNA definition of property to add for + * \return MEM_alloc'd string representing the path to the property from the given #PointerRNA + */ +char *BKE_animdata_driver_path_hack(bContext *C, PointerRNA *ptr, PropertyRNA *prop, char *base_path) +{ + ID *id = (ID *)ptr->id.data; + ScrArea *sa = CTX_wm_area(C); + + /* get standard path which may be extended */ + char *basepath = base_path ? base_path : RNA_path_from_ID_to_property(ptr, prop); + char *path = basepath; /* in case no remapping is needed */ + + /* Remapping will only be performed in the Properties Editor, as only this + * restricts the subspace of options to the 'active' data (a manageable state) + */ + /* TODO: watch out for pinned context? */ + if ((sa) && (sa->spacetype == SPACE_BUTS)) { + Object *ob = CTX_data_active_object(C); + + if (ob && id) { + /* only id-types which can be remapped to go through objects should be considered */ + switch (GS(id->name)) { + case ID_TE: /* textures */ + { + Material *ma = give_current_material(ob, ob->actcol); + Tex *tex = give_current_material_texture(ma); + + /* assumes: texture will only be shown if it is active material's active texture it's ok */ + if ((ID *)tex == id) { + char name_esc_ma[(sizeof(ma->id.name) - 2) * 2]; + char name_esc_tex[(sizeof(tex->id.name) - 2) * 2]; + + BLI_strescape(name_esc_ma, ma->id.name + 2, sizeof(name_esc_ma)); + BLI_strescape(name_esc_tex, tex->id.name + 2, sizeof(name_esc_tex)); + + /* create new path */ + // TODO: use RNA path functions to construct step by step instead? + // FIXME: maybe this isn't even needed anymore... + path = BLI_sprintfN("material_slots[\"%s\"].material.texture_slots[\"%s\"].texture.%s", + name_esc_ma, name_esc_tex, basepath); + + /* free old one */ + if (basepath != base_path) + MEM_freeN(basepath); + } + break; + } + } + + /* fix RNA pointer, as we've now changed the ID root by changing the paths */ + if (basepath != path) { + /* rebase provided pointer so that it starts from object... */ + RNA_pointer_create(&ob->id, ptr->type, ptr->data, ptr); + } + } + } + + /* the path should now have been corrected for use */ + return path; +} + /* Path Validation -------------------------------------------- */ /* Check if a given RNA Path is valid, by tracing it from the given ID, and seeing if we can resolve it */ diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 16b5574709e..bb05b5de8a6 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -505,7 +505,7 @@ void b_bone_spline_setup(bPoseChannel *pchan, int rest, Mat4 result_array[MAX_BB invert_m3_m3(imat3, mat3); mul_m3_m3m3(mat3, result, imat3); /* the matrix transforming vec_roll to desired roll */ - roll1 = (float)atan2(mat3[2][0], mat3[2][2]); + roll1 = atan2f(mat3[2][0], mat3[2][2]); } } else { @@ -543,7 +543,7 @@ void b_bone_spline_setup(bPoseChannel *pchan, int rest, Mat4 result_array[MAX_BB invert_m3_m3(imat3, mat3); mul_m3_m3m3(mat3, imat3, result); /* the matrix transforming vec_roll to desired roll */ - roll2 = (float)atan2(mat3[2][0], mat3[2][2]); + roll2 = atan2f(mat3[2][0], mat3[2][2]); /* and only now negate handle */ mul_v3_fl(h2, -hlength2); diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c index 6ce3abe7a32..1402f62291f 100644 --- a/source/blender/blenkernel/intern/camera.c +++ b/source/blender/blenkernel/intern/camera.c @@ -232,7 +232,7 @@ void BKE_camera_params_from_object(CameraParams *params, Object *ob) /* lamp object */ Lamp *la = ob->data; float fac = cosf(la->spotsize * 0.5f); - float phi = acos(fac); + float phi = acosf(fac); params->lens = 16.0f * fac / sinf(phi); if (params->lens == 0.0f) diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 08052127fbf..bfc70c91181 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -552,7 +552,7 @@ static void cdDM_drawFacesSolid(DerivedMesh *dm, MVert *mvert = cddm->mvert; MFace *mface = cddm->mface; const float *nors = dm->getTessFaceDataArray(dm, CD_NORMAL); - short (*lnors)[4][3] = dm->getTessFaceDataArray(dm, CD_TESSLOOPNORMAL); + const short (*lnors)[4][3] = dm->getTessFaceDataArray(dm, CD_TESSLOOPNORMAL); int a, glmode = -1, shademodel = -1, matnr = -1, drawCurrentMat = 1; if (cddm->pbvh && cddm->pbvh_draw) { @@ -673,9 +673,9 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm, { CDDerivedMesh *cddm = (CDDerivedMesh *) dm; MVert *mv = cddm->mvert; - MFace *mf = DM_get_tessface_data_layer(dm, CD_MFACE); + const MFace *mf = DM_get_tessface_data_layer(dm, CD_MFACE); const float *nors = dm->getTessFaceDataArray(dm, CD_NORMAL); - short (*lnors)[4][3] = dm->getTessFaceDataArray(dm, CD_TESSLOOPNORMAL); + const short (*lnors)[4][3] = dm->getTessFaceDataArray(dm, CD_TESSLOOPNORMAL); MTFace *tf = DM_get_tessface_data_layer(dm, CD_MTFACE); MCol *mcol; int i, orig; @@ -940,7 +940,7 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, MFace *mf = cddm->mface; MCol *mcol; const float *nors = DM_get_tessface_data_layer(dm, CD_NORMAL); - short (*lnors)[4][3] = dm->getTessFaceDataArray(dm, CD_TESSLOOPNORMAL); + const short (*lnors)[4][3] = dm->getTessFaceDataArray(dm, CD_TESSLOOPNORMAL); int colType, useColors = flag & DM_DRAW_USE_COLORS; int i, orig; @@ -1157,8 +1157,8 @@ static void cdDM_drawMappedFacesTex(DerivedMesh *dm, cdDM_drawFacesTex_common(dm, NULL, setDrawOptions, compareDrawOptions, userData, flag); } -static void cddm_draw_attrib_vertex(DMVertexAttribs *attribs, MVert *mvert, int a, int index, int vert, - short (*lnor)[3], int smoothnormal) +static void cddm_draw_attrib_vertex(DMVertexAttribs *attribs, const MVert *mvert, int a, int index, int vert, + const short (*lnor)[3], const bool smoothnormal) { const float zero[4] = {0.0f, 0.0f, 0.0f, 0.0f}; int b; @@ -1234,11 +1234,11 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, CDDerivedMesh *cddm = (CDDerivedMesh *) dm; GPUVertexAttribs gattribs; DMVertexAttribs attribs; - MVert *mvert = cddm->mvert; - MFace *mface = cddm->mface; + const MVert *mvert = cddm->mvert; + const MFace *mface = cddm->mface; /* MTFace *tf = dm->getTessFaceDataArray(dm, CD_MTFACE); */ /* UNUSED */ - float (*nors)[3] = dm->getTessFaceDataArray(dm, CD_NORMAL); - short (*lnors)[4][3] = dm->getTessFaceDataArray(dm, CD_TESSLOOPNORMAL); + const float (*nors)[3] = dm->getTessFaceDataArray(dm, CD_NORMAL); + const short (*lnors)[4][3] = dm->getTessFaceDataArray(dm, CD_TESSLOOPNORMAL); int a, b, matnr, new_matnr; bool do_draw; int orig; @@ -1277,8 +1277,8 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, glBegin(GL_QUADS); for (a = 0; a < dm->numTessFaceData; a++, mface++) { - const int smoothnormal = lnors || (mface->flag & ME_SMOOTH); - short (*ln1)[3] = NULL, (*ln2)[3] = NULL, (*ln3)[3] = NULL, (*ln4)[3] = NULL; + const bool smoothnormal = lnors || (mface->flag & ME_SMOOTH); + const short (*ln1)[3] = NULL, (*ln2)[3] = NULL, (*ln3)[3] = NULL, (*ln4)[3] = NULL; new_matnr = mface->mat_nr + 1; if (new_matnr != matnr) { @@ -1323,13 +1323,11 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, glNormal3fv(nor); } } - - if (lnors) { - ln1 = &lnors[0][0]; - ln2 = &lnors[0][1]; - ln3 = &lnors[0][2]; - ln4 = &lnors[0][3]; - lnors++; + else if (lnors) { + ln1 = &lnors[a][0]; + ln2 = &lnors[a][1]; + ln3 = &lnors[a][2]; + ln4 = &lnors[a][3]; } cddm_draw_attrib_vertex(&attribs, mvert, a, mface->v1, 0, ln1, smoothnormal); @@ -1350,7 +1348,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, int start = 0, numfaces = 0 /* , prevdraw = 0 */ /* UNUSED */, curface = 0; int i; - MFace *mf = mface; + const MFace *mf = mface; GPUAttrib datatypes[GPU_MAX_ATTRIB]; /* TODO, messing up when switching materials many times - [#21056]*/ memset(&attribs, 0, sizeof(attribs)); @@ -1574,8 +1572,8 @@ static void cdDM_drawMappedFacesMat(DerivedMesh *dm, DMVertexAttribs attribs; MVert *mvert = cddm->mvert; MFace *mf = cddm->mface; - float (*nors)[3] = dm->getTessFaceDataArray(dm, CD_NORMAL); - short (*lnors)[4][3] = dm->getTessFaceDataArray(dm, CD_TESSLOOPNORMAL); + const float (*nors)[3] = dm->getTessFaceDataArray(dm, CD_NORMAL); + const short (*lnors)[4][3] = dm->getTessFaceDataArray(dm, CD_TESSLOOPNORMAL); int a, matnr, new_matnr; int orig; @@ -1610,8 +1608,8 @@ static void cdDM_drawMappedFacesMat(DerivedMesh *dm, glBegin(GL_QUADS); for (a = 0; a < dm->numTessFaceData; a++, mf++) { - const int smoothnormal = lnors || (mf->flag & ME_SMOOTH); - short (*ln1)[3] = NULL, (*ln2)[3] = NULL, (*ln3)[3] = NULL, (*ln4)[3] = NULL; + const bool smoothnormal = lnors || (mf->flag & ME_SMOOTH); + const short (*ln1)[3] = NULL, (*ln2)[3] = NULL, (*ln3)[3] = NULL, (*ln4)[3] = NULL; /* material */ new_matnr = mf->mat_nr + 1; @@ -1650,13 +1648,11 @@ static void cdDM_drawMappedFacesMat(DerivedMesh *dm, glNormal3fv(nor); } } - - if (lnors) { - ln1 = &lnors[0][0]; - ln2 = &lnors[0][1]; - ln3 = &lnors[0][2]; - ln4 = &lnors[0][3]; - lnors++; + else if (lnors) { + ln1 = &lnors[a][0]; + ln2 = &lnors[a][1]; + ln3 = &lnors[a][2]; + ln4 = &lnors[a][3]; } /* vertices */ @@ -2720,7 +2716,7 @@ static unsigned int poly_gset_hash_fn(const void *key) return pk->hash_sum; } -static int poly_gset_compare_fn(const void *k1, const void *k2) +static bool poly_gset_compare_fn(const void *k1, const void *k2) { const PolyKey *pk1 = k1; const PolyKey *pk2 = k2; @@ -3017,10 +3013,17 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap, const int if (UNLIKELY(c == 0)) { continue; } + else if (UNLIKELY(c < 3)) { + STACK_DISCARD(oldl, c); + STACK_DISCARD(mloop, c); + continue; + } + mp_new = STACK_PUSH_RET_PTR(mpoly); *mp_new = *mp; mp_new->totloop = c; + BLI_assert(mp_new->totloop >= 3); mp_new->loopstart = STACK_SIZE(mloop) - c; STACK_PUSH(oldp, i); @@ -3091,7 +3094,7 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap, const int MEM_freeN(oldv); MEM_freeN(olde); MEM_freeN(oldl); - MEM_freeN(oldp);; + MEM_freeN(oldp); BLI_edgehash_free(ehash, NULL); diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index 885f186faf3..aacf02555d4 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -228,7 +228,7 @@ void bvhtree_update_from_cloth(ClothModifierData *clmd, int moving) ClothVertex *verts = cloth->verts; MFace *mfaces; float co[12], co_moving[12]; - int ret = 0; + bool ret = false; if (!bvhtree) return; diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c index cedd9eae597..2f600935b1e 100644 --- a/source/blender/blenkernel/intern/collision.c +++ b/source/blender/blenkernel/intern/collision.c @@ -110,7 +110,7 @@ void bvhtree_update_from_mvert(BVHTree *bvhtree, MFace *faces, int numfaces, MVe int i; MFace *mfaces = faces; float co[12], co_moving[12]; - int ret = 0; + bool ret = false; if ( !bvhtree ) return; diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index c6d07a959d1..a63e06c7cb8 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -577,14 +577,14 @@ static void curvemap_make_table(CurveMap *cuma, const rctf *clipr) /* store first and last handle for extrapolation, unit length */ cuma->ext_in[0] = bezt[0].vec[0][0] - bezt[0].vec[1][0]; cuma->ext_in[1] = bezt[0].vec[0][1] - bezt[0].vec[1][1]; - range = sqrt(cuma->ext_in[0] * cuma->ext_in[0] + cuma->ext_in[1] * cuma->ext_in[1]); + range = sqrtf(cuma->ext_in[0] * cuma->ext_in[0] + cuma->ext_in[1] * cuma->ext_in[1]); cuma->ext_in[0] /= range; cuma->ext_in[1] /= range; a = cuma->totpoint - 1; cuma->ext_out[0] = bezt[a].vec[1][0] - bezt[a].vec[2][0]; cuma->ext_out[1] = bezt[a].vec[1][1] - bezt[a].vec[2][1]; - range = sqrt(cuma->ext_out[0] * cuma->ext_out[0] + cuma->ext_out[1] * cuma->ext_out[1]); + range = sqrtf(cuma->ext_out[0] * cuma->ext_out[0] + cuma->ext_out[1] * cuma->ext_out[1]); cuma->ext_out[0] /= range; cuma->ext_out[1] /= range; diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index d80529ee780..ee7bad773fa 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -3592,7 +3592,7 @@ static void damptrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t cross_v3_v3v3(raxis, obvec, tarvec); rangle = dot_v3v3(obvec, tarvec); - rangle = acos(max_ff(-1.0f, min_ff(1.0f, rangle))); + rangle = acosf(max_ff(-1.0f, min_ff(1.0f, rangle))); /* construct rotation matrix from the axis-angle rotation found above * - this call takes care to make sure that the axis provided is a unit vector first diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index a06834f61b3..ca58035d638 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -2468,7 +2468,7 @@ static void make_bevel_list_2D(BevList *bl) /* first */ bevp = bl->bevpoints; - angle = atan2(bevp->dir[0], bevp->dir[1]) - M_PI / 2.0; + angle = atan2f(bevp->dir[0], bevp->dir[1]) - (float)(M_PI / 2.0f); bevp->sina = sinf(angle); bevp->cosa = cosf(angle); vec_to_quat(bevp->quat, bevp->dir, 5, 1); @@ -2476,7 +2476,7 @@ static void make_bevel_list_2D(BevList *bl) /* last */ bevp = bl->bevpoints; bevp += (bl->nr - 1); - angle = atan2(bevp->dir[0], bevp->dir[1]) - M_PI / 2.0; + angle = atan2f(bevp->dir[0], bevp->dir[1]) - (float)(M_PI / 2.0f); bevp->sina = sinf(angle); bevp->cosa = cosf(angle); vec_to_quat(bevp->quat, bevp->dir, 5, 1); @@ -2590,7 +2590,7 @@ void BKE_curve_bevelList_make(Object *ob, ListBase *nurbs, bool for_render) if (nu->type == CU_POLY) { len = nu->pntsu; bl = MEM_callocN(sizeof(BevList) + len * sizeof(BevPoint), "makeBevelList2"); - if (need_seglen) { + if (need_seglen && (nu->flagu & CU_NURB_CYCLIC) == 0) { bl->seglen = MEM_mallocN(segcount * sizeof(float), "makeBevelList2_seglen"); bl->segbevcount = MEM_mallocN(segcount * sizeof(int), "makeBevelList2_segbevcount"); } @@ -2613,7 +2613,7 @@ void BKE_curve_bevelList_make(Object *ob, ListBase *nurbs, bool for_render) bevp->weight = bp->weight; bevp->split_tag = true; bp++; - if (seglen != NULL) { + if (seglen != NULL && len != 0) { *seglen = len_v3v3(bevp->vec, bp->vec); bevp++; bevp->offset = *seglen; @@ -2629,11 +2629,6 @@ void BKE_curve_bevelList_make(Object *ob, ListBase *nurbs, bool for_render) if ((nu->flagu & CU_NURB_CYCLIC) == 0) { bevlist_firstlast_direction_calc_from_bpoint(nu, bl); - if (seglen != NULL) { - *seglen = len_v3v3(bevp->vec, nu->bp->vec); - bl->bevpoints->offset = *seglen; - *segbevcount = 1; - } } } else if (nu->type == CU_BEZIER) { @@ -2641,7 +2636,7 @@ void BKE_curve_bevelList_make(Object *ob, ListBase *nurbs, bool for_render) len = segcount * resolu + 1; bl = MEM_callocN(sizeof(BevList) + len * sizeof(BevPoint), "makeBevelBPoints"); - if (need_seglen) { + if (need_seglen && (nu->flagu & CU_NURB_CYCLIC) == 0) { bl->seglen = MEM_mallocN(segcount * sizeof(float), "makeBevelBPoints_seglen"); bl->segbevcount = MEM_mallocN(segcount * sizeof(int), "makeBevelBPoints_segbevcount"); } @@ -2777,7 +2772,7 @@ void BKE_curve_bevelList_make(Object *ob, ListBase *nurbs, bool for_render) len = (resolu * segcount); bl = MEM_callocN(sizeof(BevList) + len * sizeof(BevPoint), "makeBevelList3"); - if (need_seglen) { + if (need_seglen && (nu->flagu & CU_NURB_CYCLIC) == 0) { bl->seglen = MEM_mallocN(segcount * sizeof(float), "makeBevelList3_seglen"); bl->segbevcount = MEM_mallocN(segcount * sizeof(int), "makeBevelList3_segbevcount"); } diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index ab3cf5851e9..63eb3b397b0 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -2554,12 +2554,12 @@ void CustomData_bmesh_free_block(CustomData *data, void **block) /** * Same as #CustomData_bmesh_free_block but zero the memory rather then freeing. */ -void CustomData_bmesh_free_block_data(CustomData *data, void **block) +void CustomData_bmesh_free_block_data(CustomData *data, void *block) { const LayerTypeInfo *typeInfo; int i; - if (*block == NULL) + if (block == NULL) return; for (i = 0; i < data->totlayer; ++i) { @@ -2568,13 +2568,13 @@ void CustomData_bmesh_free_block_data(CustomData *data, void **block) if (typeInfo->free) { int offset = data->layers[i].offset; - typeInfo->free((char *)*block + offset, 1, typeInfo->size); + typeInfo->free((char *)block + offset, 1, typeInfo->size); } } } if (data->totsize) - memset(*block, 0, data->totsize); + memset(block, 0, data->totsize); } static void CustomData_bmesh_alloc_block(CustomData *data, void **block) diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 93bb4849718..44a0b93fc01 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -75,6 +75,7 @@ #include "BKE_mball.h" #include "BKE_modifier.h" #include "BKE_object.h" +#include "BKE_paint.h" #include "BKE_particle.h" #include "BKE_pointcache.h" #include "BKE_scene.h" @@ -2509,6 +2510,7 @@ static void dag_id_flush_update(Main *bmain, Scene *sce, ID *id) obt = sce->basact ? sce->basact->object : NULL; if (obt && obt->mode & OB_MODE_TEXTURE_PAINT) { BKE_texpaint_slots_refresh_object(sce, obt); + BKE_paint_proj_mesh_data_check(sce, obt, NULL, NULL, NULL, NULL); GPU_drawobject_free(obt->derivedFinal); } } diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 24ee470eaa7..ced9da8d0b1 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -872,7 +872,7 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected case PFIELD_HARMONIC: mul_v3_fl(force, -strength * efd->falloff); copy_v3_v3(temp, point->vel); - mul_v3_fl(temp, -damp * 2.0f * (float)sqrt(fabs(strength)) * point->vel_to_sec); + mul_v3_fl(temp, -damp * 2.0f * sqrtf(fabsf(strength)) * point->vel_to_sec); add_v3_v3(force, temp); break; case PFIELD_CHARGE: diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 09c1dcf701d..e90a0891436 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -55,6 +55,7 @@ #include "BKE_action.h" #include "BKE_armature.h" #include "BKE_constraint.h" +#include "BKE_context.h" #include "BKE_curve.h" #include "BKE_global.h" #include "BKE_object.h" @@ -310,19 +311,35 @@ int list_find_data_fcurves(ListBase *dst, ListBase *src, const char *dataPrefix, FCurve *rna_get_fcurve(PointerRNA *ptr, PropertyRNA *prop, int rnaindex, bAction **action, bool *r_driven) { + return rna_get_fcurve_context_ui(NULL, ptr, prop, rnaindex, action, r_driven); +} + +FCurve *rna_get_fcurve_context_ui(bContext *C, PointerRNA *ptr, PropertyRNA *prop, int rnaindex, + bAction **action, bool *r_driven) +{ FCurve *fcu = NULL; + PointerRNA tptr = *ptr; *r_driven = false; /* there must be some RNA-pointer + property combon */ - if (prop && ptr->id.data && RNA_property_animateable(ptr, prop)) { - AnimData *adt = BKE_animdata_from_id(ptr->id.data); - char *path; + if (prop && tptr.id.data && RNA_property_animateable(&tptr, prop)) { + AnimData *adt = BKE_animdata_from_id(tptr.id.data); + int step = C ? 2 : 1; /* Always 1 in case we have no context (can't check in 'ancestors' of given RNA ptr). */ + char *path = NULL; - if (adt) { + if (!adt && C) { + path = BKE_animdata_driver_path_hack(C, &tptr, prop, NULL); + adt = BKE_animdata_from_id(tptr.id.data); + step--; + } + + while (adt && step--) { if ((adt->action && adt->action->curves.first) || (adt->drivers.first)) { /* XXX this function call can become a performance bottleneck */ - path = RNA_path_from_ID_to_property(ptr, prop); + if (step) { + path = RNA_path_from_ID_to_property(&tptr, prop); + } if (path) { /* animation takes priority over drivers */ @@ -337,13 +354,25 @@ FCurve *rna_get_fcurve(PointerRNA *ptr, PropertyRNA *prop, int rnaindex, bAction *r_driven = true; } - if (fcu && action) + if (fcu && action) { *action = adt->action; - - MEM_freeN(path); + break; + } + else if (step) { + char *tpath = BKE_animdata_driver_path_hack(C, &tptr, prop, path); + if (tpath && tpath != path) { + MEM_freeN(path); + path = tpath; + adt = BKE_animdata_from_id(tptr.id.data); + } + else { + adt = NULL; + } + } } } } + MEM_SAFE_FREE(path); } return fcu; diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 805c1250c5d..5c673eeef3f 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -62,6 +62,7 @@ #include "DNA_meshdata_types.h" #include "BLI_blenlib.h" +#include "BLI_math_vector.h" #include "BLI_threads.h" #include "BLI_timecode.h" /* for stamp timecode format */ #include "BLI_utildefines.h" @@ -120,12 +121,12 @@ static unsigned int imagecache_hashhash(const void *key_v) return key->index; } -static int imagecache_hashcmp(const void *a_v, const void *b_v) +static bool imagecache_hashcmp(const void *a_v, const void *b_v) { const ImageCacheKey *a = (ImageCacheKey *) a_v; const ImageCacheKey *b = (ImageCacheKey *) b_v; - return a->index - b->index; + return (a->index != b->index); } static void imagecache_keydata(void *userkey, int *framenr, int *proxy, int *render_flags) @@ -365,6 +366,7 @@ Image *BKE_image_copy(Main *bmain, Image *ima) nima->gen_x = ima->gen_x; nima->gen_y = ima->gen_y; nima->gen_type = ima->gen_type; + copy_v4_v4(nima->gen_color, ima->gen_color); nima->animspeed = ima->animspeed; @@ -769,6 +771,7 @@ Image *BKE_image_add_generated(Main *bmain, unsigned int width, unsigned int hei ima->gen_type = gen_type; ima->gen_flag |= (floatbuf ? IMA_GEN_FLOAT : 0); ima->gen_depth = depth; + copy_v4_v4(ima->gen_color, color); ibuf = add_ibuf_size(width, height, ima->name, depth, floatbuf, gen_type, color, &ima->colorspace_settings); image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0); @@ -2996,7 +2999,6 @@ BLI_INLINE bool image_quick_test(Image *ima, ImageUser *iuser) static ImBuf *image_acquire_ibuf(Image *ima, ImageUser *iuser, void **lock_r) { ImBuf *ibuf = NULL; - float color[] = {0, 0, 0, 1}; int frame = 0, index = 0; if (lock_r) @@ -3041,7 +3043,7 @@ static ImBuf *image_acquire_ibuf(Image *ima, ImageUser *iuser, void **lock_r) if (ima->gen_y == 0) ima->gen_y = 1024; if (ima->gen_depth == 0) ima->gen_depth = 24; ibuf = add_ibuf_size(ima->gen_x, ima->gen_y, ima->name, ima->gen_depth, (ima->gen_flag & IMA_GEN_FLOAT) != 0, ima->gen_type, - color, &ima->colorspace_settings); + ima->gen_color, &ima->colorspace_settings); image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0); ima->ok = IMA_OK_LOADED; } diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c index 4d80256426d..4cf9d52989f 100644 --- a/source/blender/blenkernel/intern/implicit.c +++ b/source/blender/blenkernel/intern/implicit.c @@ -1236,7 +1236,7 @@ DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s, sub_v3_v3v3(extent, X[s->kl], X[s->ij]); sub_v3_v3v3(vel, V[s->kl], V[s->ij]); dot = dot_v3v3(extent, extent); - length = sqrt(dot); + length = sqrtf(dot); s->flags &= ~CLOTH_SPRING_FLAG_NEEDED; diff --git a/source/blender/blenkernel/intern/lamp.c b/source/blender/blenkernel/intern/lamp.c index 749e915e5ca..4a413850ec0 100644 --- a/source/blender/blenkernel/intern/lamp.c +++ b/source/blender/blenkernel/intern/lamp.c @@ -135,8 +135,7 @@ Lamp *localize_lamp(Lamp *la) Lamp *lan; int a; - lan = BKE_libblock_copy(&la->id); - BLI_remlink(&G.main->lamp, lan); + lan = BKE_libblock_copy_nolib(&la->id, false); for (a = 0; a < MAX_MTEX; a++) { if (lan->mtex[a]) { diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 515287de336..b49eee3ea22 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -620,6 +620,8 @@ int set_listbasepointers(Main *main, ListBase **lb) lb[a] = NULL; + BLI_assert(a + 1 == MAX_LIBARRAY); + return a; } diff --git a/source/blender/blenkernel/intern/linestyle.c b/source/blender/blenkernel/intern/linestyle.c index 45695844101..5e17117a875 100644 --- a/source/blender/blenkernel/intern/linestyle.c +++ b/source/blender/blenkernel/intern/linestyle.c @@ -93,6 +93,7 @@ static void default_linestyle_settings(FreestyleLineStyle *linestyle) linestyle->min_length = 0.0f; linestyle->max_length = 10000.0f; linestyle->split_length = 100; + linestyle->chain_count = 10; linestyle->sort_key = LS_SORT_KEY_DISTANCE_FROM_CAMERA; linestyle->integration_type = LS_INTEGRATION_MEAN; linestyle->texstep = 1.0f; @@ -186,6 +187,7 @@ FreestyleLineStyle *BKE_linestyle_copy(FreestyleLineStyle *linestyle) new_linestyle->max_angle = linestyle->max_angle; new_linestyle->min_length = linestyle->min_length; new_linestyle->max_length = linestyle->max_length; + new_linestyle->chain_count = linestyle->chain_count; new_linestyle->split_dash1 = linestyle->split_dash1; new_linestyle->split_gap1 = linestyle->split_gap1; new_linestyle->split_dash2 = linestyle->split_dash2; diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c index 1c40446c217..83ad2f1b2d2 100644 --- a/source/blender/blenkernel/intern/mask.c +++ b/source/blender/blenkernel/intern/mask.c @@ -1821,10 +1821,10 @@ void BKE_mask_layer_shape_unlink(MaskLayer *masklay, MaskLayerShape *masklay_sha BKE_mask_layer_shape_free(masklay_shape); } -static int mask_layer_shape_sort_cb(void *masklay_shape_a_ptr, void *masklay_shape_b_ptr) +static int mask_layer_shape_sort_cb(const void *masklay_shape_a_ptr, const void *masklay_shape_b_ptr) { - MaskLayerShape *masklay_shape_a = (MaskLayerShape *)masklay_shape_a_ptr; - MaskLayerShape *masklay_shape_b = (MaskLayerShape *)masklay_shape_b_ptr; + const MaskLayerShape *masklay_shape_a = masklay_shape_a_ptr; + const MaskLayerShape *masklay_shape_b = masklay_shape_b_ptr; if (masklay_shape_a->frame < masklay_shape_b->frame) return -1; else if (masklay_shape_a->frame > masklay_shape_b->frame) return 1; diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index 35bf453c328..e28adb7c0e0 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -406,27 +406,14 @@ static unsigned int moviecache_hashhash(const void *keyv) return rval; } -static int moviecache_hashcmp(const void *av, const void *bv) +static bool moviecache_hashcmp(const void *av, const void *bv) { const MovieClipImBufCacheKey *a = (MovieClipImBufCacheKey *)av; const MovieClipImBufCacheKey *b = (MovieClipImBufCacheKey *)bv; - if (a->framenr < b->framenr) - return -1; - else if (a->framenr > b->framenr) - return 1; - - if (a->proxy < b->proxy) - return -1; - else if (a->proxy > b->proxy) - return 1; - - if (a->render_flag < b->render_flag) - return -1; - else if (a->render_flag > b->render_flag) - return 1; - - return 0; + return ((a->framenr != b->framenr) || + (a->proxy != b->proxy) || + (a->render_flag != b->render_flag)); } static void *moviecache_getprioritydata(void *key_v) diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 0f86b551092..3a7bfb03e07 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -2682,16 +2682,12 @@ static unsigned int node_instance_hash_key(const void *key) return ((const bNodeInstanceKey *)key)->value; } -static int node_instance_hash_key_cmp(const void *a, const void *b) +static bool node_instance_hash_key_cmp(const void *a, const void *b) { unsigned int value_a = ((const bNodeInstanceKey *)a)->value; unsigned int value_b = ((const bNodeInstanceKey *)b)->value; - if (value_a == value_b) - return 0; - else if (value_a < value_b) - return -1; - else - return 1; + + return (value_a != value_b); } bNodeInstanceHash *BKE_node_instance_hash_new(const char *info) diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index b09016506e3..755ce91a8af 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1067,10 +1067,10 @@ void BKE_object_lod_add(Object *ob) BLI_addtail(&ob->lodlevels, lod); } -static int lod_cmp(void *a, void *b) +static int lod_cmp(const void *a, const void *b) { - LodLevel *loda = (LodLevel *)a; - LodLevel *lodb = (LodLevel *)b; + const LodLevel *loda = a; + const LodLevel *lodb = b; if (loda->distance < lodb->distance) return -1; return loda->distance > lodb->distance; @@ -3242,9 +3242,9 @@ bool BKE_boundbox_ray_hit_check( return result; } -static int pc_cmp(void *a, void *b) +static int pc_cmp(const void *a, const void *b) { - LinkData *ad = a, *bd = b; + const LinkData *ad = a, *bd = b; if (GET_INT_FROM_POINTER(ad->data) > GET_INT_FROM_POINTER(bd->data)) return 1; else return 0; diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index 4382d74f34e..d16575d80c8 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -315,8 +315,14 @@ void BKE_paint_curve_set(Brush *br, PaintCurve *pc) /* remove colour from palette. Must be certain color is inside the palette! */ void BKE_palette_color_remove(Palette *palette, PaletteColor *color) { - BLI_remlink(&palette->colors, color); - BLI_addhead(&palette->deleted, color); + if (color) { + int numcolors = BLI_countlist(&palette->colors); + if ((numcolors == palette->active_color + 1) && (numcolors != 1)) + palette->active_color--; + + BLI_remlink(&palette->colors, color); + BLI_addhead(&palette->deleted, color); + } } void BKE_palette_cleanup(Palette *palette) @@ -350,19 +356,6 @@ PaletteColor *BKE_palette_color_add(Palette *palette) return color; } -void BKE_palette_color_delete(struct Palette *palette) -{ - PaletteColor *color = BLI_findlink(&palette->colors, palette->active_color); - - if (color) { - if ((color == palette->colors.last) && (palette->colors.last != palette->colors.first)) - palette->active_color--; - - BLI_remlink(&palette->colors, color); - BLI_addhead(&palette->deleted, color); - } -} - bool BKE_palette_is_empty(const struct Palette *palette) { @@ -493,7 +486,7 @@ void paint_calculate_rake_rotation(UnifiedPaintSettings *ups, const float mouse_ sub_v2_v2v2(dpos, ups->last_rake, mouse_pos); if (len_squared_v2(dpos) >= r * r) { - ups->brush_rotation = atan2(dpos[0], dpos[1]); + ups->brush_rotation = atan2f(dpos[0], dpos[1]); interp_v2_v2v2(ups->last_rake, ups->last_rake, mouse_pos, u); diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 27d346f65b9..530573d6e38 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -656,7 +656,7 @@ static float psys_render_projected_area(ParticleSystem *psys, const float center } /* screen space radius */ - radius = sqrt(area / (float)M_PI); + radius = sqrtf(area / (float)M_PI); /* make smaller using fallof once over screen edge */ *viewport = 1.0f; @@ -917,8 +917,8 @@ int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot) elem->scalemax = (lambda + t < 1.0f) ? 1.0f / lambda : 1.0f / (1.0f - elem->t * elem->t / t); elem->scalemin = (lambda + t < 1.0f) ? 0.0f : elem->scalemax * (1.0f - elem->t / t); - elem->scalemin = sqrt(elem->scalemin); - elem->scalemax = sqrt(elem->scalemax); + elem->scalemin = sqrtf(elem->scalemin); + elem->scalemax = sqrtf(elem->scalemax); /* clamp scaling */ scaleclamp = (float)min_ii(elem->totchild, 10); @@ -939,8 +939,8 @@ int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot) } elem->lambda = lambda; - elem->scalemin = sqrt(elem->scalemin); - elem->scalemax = sqrt(elem->scalemax); + elem->scalemin = sqrtf(elem->scalemin); + elem->scalemax = sqrtf(elem->scalemax); elem->curchild = 0; } @@ -1950,10 +1950,10 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float t = time * freq * (float)M_PI; if (smooth_start) { - dt = fabs(t); + dt = fabsf(t); /* smooth the beginning of kink */ CLAMP(dt, 0.f, (float)M_PI); - dt = sin(dt / 2.f); + dt = sinf(dt / 2.f); } if (type != PART_KINK_RADIAL) { @@ -2014,12 +2014,12 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float madd_v3_v3fl(result, proj, flat); } - madd_v3_v3fl(result, par_vec, -amplitude * (float)sin(t)); + madd_v3_v3fl(result, par_vec, -amplitude * sinf(t)); break; } case PART_KINK_WAVE: { - madd_v3_v3fl(result, kink, amplitude * (float)sin(t)); + madd_v3_v3fl(result, kink, amplitude * sinf(t)); if (flat > 0.f) { float proj[3]; @@ -2054,22 +2054,22 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float if (inp_y > 0.5f) { copy_v3_v3(state_co, y_vec); - mul_v3_fl(y_vec, amplitude * (float)cos(t)); - mul_v3_fl(z_vec, amplitude / 2.f * (float)sin(2.f * t)); + mul_v3_fl(y_vec, amplitude * cosf(t)); + mul_v3_fl(z_vec, amplitude / 2.f * sinf(2.f * t)); } else if (inp_z > 0.0f) { - mul_v3_v3fl(state_co, z_vec, (float)sin((float)M_PI / 3.f)); + mul_v3_v3fl(state_co, z_vec, sinf((float)M_PI / 3.f)); madd_v3_v3fl(state_co, y_vec, -0.5f); - mul_v3_fl(y_vec, -amplitude * (float)cos(t + (float)M_PI / 3.f)); - mul_v3_fl(z_vec, amplitude / 2.f * (float)cos(2.f * t + (float)M_PI / 6.f)); + mul_v3_fl(y_vec, -amplitude * cosf(t + (float)M_PI / 3.f)); + mul_v3_fl(z_vec, amplitude / 2.f * cosf(2.f * t + (float)M_PI / 6.f)); } else { - mul_v3_v3fl(state_co, z_vec, -(float)sin((float)M_PI / 3.f)); + mul_v3_v3fl(state_co, z_vec, -sinf((float)M_PI / 3.f)); madd_v3_v3fl(state_co, y_vec, -0.5f); - mul_v3_fl(y_vec, amplitude * (float)-sin(t + (float)M_PI / 6.f)); - mul_v3_fl(z_vec, amplitude / 2.f * (float)-sin(2.f * t + (float)M_PI / 3.f)); + mul_v3_fl(y_vec, amplitude * -sinf(t + (float)M_PI / 6.f)); + mul_v3_fl(z_vec, amplitude / 2.f * -sinf(2.f * t + (float)M_PI / 3.f)); } mul_v3_fl(state_co, amplitude); @@ -2271,8 +2271,11 @@ static void do_rough(float *loc, float mat[4][4], float t, float fac, float size float rough[3]; float rco[3]; - if (thres != 0.0f) - if ((float)fabs((float)(-1.5f + loc[0] + loc[1] + loc[2])) < 1.5f * thres) return; + if (thres != 0.0f) { + if (fabsf((float)(-1.5f + loc[0] + loc[1] + loc[2])) < 1.5f * thres) { + return; + } + } copy_v3_v3(rco, loc); mul_v3_fl(rco, t); @@ -4567,8 +4570,8 @@ void psys_get_dupli_path_transform(ParticleSimulationData *sim, ParticleData *pa normalize_v3(nor); /* make sure that we get a proper side vector */ - if (fabs(dot_v3v3(nor, vec)) > 0.999999) { - if (fabs(dot_v3v3(nor, xvec)) > 0.999999) { + if (fabsf(dot_v3v3(nor, vec)) > 0.999999) { + if (fabsf(dot_v3v3(nor, xvec)) > 0.999999) { nor[0] = 0.0f; nor[1] = 1.0f; nor[2] = 0.0f; @@ -4676,12 +4679,12 @@ void psys_make_billboard(ParticleBillboardData *bb, float xvec[3], float yvec[3] copy_v3_v3(tvec, xvec); copy_v3_v3(tvec2, yvec); - mul_v3_fl(xvec, cos(bb->tilt * (float)M_PI)); - mul_v3_fl(tvec2, sin(bb->tilt * (float)M_PI)); + mul_v3_fl(xvec, cosf(bb->tilt * (float)M_PI)); + mul_v3_fl(tvec2, sinf(bb->tilt * (float)M_PI)); add_v3_v3(xvec, tvec2); - mul_v3_fl(yvec, cos(bb->tilt * (float)M_PI)); - mul_v3_fl(tvec, -sin(bb->tilt * (float)M_PI)); + mul_v3_fl(yvec, cosf(bb->tilt * (float)M_PI)); + mul_v3_fl(tvec, -sinf(bb->tilt * (float)M_PI)); add_v3_v3(yvec, tvec); mul_v3_fl(xvec, bb->size[0]); diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 09e20c02691..155299b69c3 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -701,7 +701,7 @@ static void init_mv_jit(float *jit, int num, int seed2, float amount) rad1= (float)(1.0f/sqrtf((float)num)); rad2= (float)(1.0f/((float)num)); - rad3= (float)sqrt((float)num)/((float)num); + rad3= (float)sqrtf((float)num)/((float)num); rng = BLI_rng_new(31415926 + num + seed2); x= 0; diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c index 55653f41e75..1a0ddac03d7 100644 --- a/source/blender/blenkernel/intern/pbvh_bmesh.c +++ b/source/blender/blenkernel/intern/pbvh_bmesh.c @@ -823,15 +823,16 @@ static bool pbvh_bmesh_subdivide_long_edges(EdgeQueueContext *eq_ctx, PBVH *bvh, return any_subdivided; } -static void pbvh_bmesh_collapse_edge(PBVH *bvh, BMEdge *e, - BMVert *v1, BMVert *v2, - GSet *deleted_verts, - BLI_Buffer *edge_loops, - BLI_Buffer *deleted_faces, - EdgeQueueContext *eq_ctx) +static void pbvh_bmesh_collapse_edge( + PBVH *bvh, BMEdge *e, + BMVert *v1, BMVert *v2, + GSet *deleted_verts, + BLI_Buffer *deleted_faces, + EdgeQueueContext *eq_ctx) { BMIter bm_iter; BMFace *f; + BMLoop *l_adj; BMVert *v_del, *v_conn; int i; float mask_v1 = BM_ELEM_CD_GET_FLOAT(v1, eq_ctx->cd_vert_mask_offset); @@ -846,15 +847,11 @@ static void pbvh_bmesh_collapse_edge(PBVH *bvh, BMEdge *e, v_conn = v1; } - /* Get all faces adjacent to the edge */ - pbvh_bmesh_edge_loops(edge_loops, e); - /* Remove the merge vertex from the PBVH */ pbvh_bmesh_vert_remove(bvh, v_del, eq_ctx->cd_vert_node_offset, eq_ctx->cd_face_node_offset); /* Remove all faces adjacent to the edge */ - for (i = 0; i < edge_loops->count; i++) { - BMLoop *l_adj = BLI_buffer_at(edge_loops, BMLoop *, i); + while ((l_adj = e->l)) { BMFace *f_adj = l_adj->f; pbvh_bmesh_face_remove(bvh, f_adj, eq_ctx->cd_vert_node_offset, eq_ctx->cd_face_node_offset); @@ -973,10 +970,10 @@ static void pbvh_bmesh_collapse_edge(PBVH *bvh, BMEdge *e, BM_vert_kill(bvh->bm, v_del); } -static bool pbvh_bmesh_collapse_short_edges(EdgeQueueContext *eq_ctx, - PBVH *bvh, - BLI_Buffer *edge_loops, - BLI_Buffer *deleted_faces) +static bool pbvh_bmesh_collapse_short_edges( + EdgeQueueContext *eq_ctx, + PBVH *bvh, + BLI_Buffer *deleted_faces) { float min_len_squared = bvh->bm_min_edge_len * bvh->bm_min_edge_len; GSet *deleted_verts; @@ -1020,7 +1017,7 @@ static bool pbvh_bmesh_collapse_short_edges(EdgeQueueContext *eq_ctx, any_collapsed = true; pbvh_bmesh_collapse_edge(bvh, e, v1, v2, - deleted_verts, edge_loops, + deleted_verts, deleted_faces, eq_ctx); } @@ -1214,7 +1211,7 @@ bool BKE_pbvh_bmesh_update_topology(PBVH *bvh, PBVHTopologyUpdateMode mode, const float center[3], float radius) { /* 2 is enough for edge faces - manifold edge */ - BLI_buffer_declare_static(BMFace *, edge_loops, BLI_BUFFER_NOP, 2); + BLI_buffer_declare_static(BMLoop *, edge_loops, BLI_BUFFER_NOP, 2); BLI_buffer_declare_static(BMFace *, deleted_faces, BLI_BUFFER_NOP, 32); const int cd_vert_mask_offset = CustomData_get_offset(&bvh->bm->vdata, CD_PAINT_MASK); const int cd_vert_node_offset = bvh->cd_vert_node_offset; @@ -1230,7 +1227,7 @@ bool BKE_pbvh_bmesh_update_topology(PBVH *bvh, PBVHTopologyUpdateMode mode, short_edge_queue_create(&eq_ctx, bvh, center, radius); modified |= !BLI_heap_is_empty(q.heap); - pbvh_bmesh_collapse_short_edges(&eq_ctx, bvh, &edge_loops, + pbvh_bmesh_collapse_short_edges(&eq_ctx, bvh, &deleted_faces); BLI_heap_free(q.heap, NULL); BLI_mempool_destroy(queue_pool); diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 063a81e6efb..a6a7664ec61 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -85,11 +85,12 @@ #ifdef WITH_LZO #include "minilzo.h" -#else -/* used for non-lzo cases */ -#define LZO_OUT_LEN(size) ((size) + (size) / 16 + 64 + 3) +#define LZO_HEAP_ALLOC(var,size) \ + lzo_align_t __LZO_MMODEL var [ ((size) + (sizeof(lzo_align_t) - 1)) / sizeof(lzo_align_t) ] #endif +#define LZO_OUT_LEN(size) ((size) + (size) / 16 + 64 + 3) + #ifdef WITH_LZMA #include "LzmaLib.h" #endif diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index eb98e381222..5bfd6e8a120 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -93,9 +93,6 @@ #include "bmesh.h" -//XXX #include "BIF_previewrender.h" -//XXX #include "BIF_editseq.h" - #ifdef WIN32 #else # include <sys/time.h> @@ -521,6 +518,9 @@ Scene *BKE_scene_add(Main *bmain, const char *name) sce->r.preview_start_resolution = 64; + sce->r.line_thickness_mode = R_LINE_THICKNESS_ABSOLUTE; + sce->r.unit_line_thickness = 1.0f; + sce->toolsettings = MEM_callocN(sizeof(struct ToolSettings), "Tool Settings Struct"); sce->toolsettings->doublimit = 0.001; sce->toolsettings->uvcalc_margin = 0.001f; @@ -1991,14 +1991,13 @@ double BKE_scene_unit_scale(const UnitSettings *unit, const int unit_type, doubl switch (unit_type) { case B_UNIT_LENGTH: return value * (double)unit->scale_length; - case B_UNIT_CAMERA: - return value * (double)unit->scale_length; case B_UNIT_AREA: return value * pow(unit->scale_length, 2); case B_UNIT_VOLUME: return value * pow(unit->scale_length, 3); case B_UNIT_MASS: return value * pow(unit->scale_length, 3); + case B_UNIT_CAMERA: /* *Do not* use scene's unit scale for camera focal lens! See T42026. */ default: return value; } diff --git a/source/blender/blenkernel/intern/seqcache.c b/source/blender/blenkernel/intern/seqcache.c index 97062f728c5..4268b33cb14 100644 --- a/source/blender/blenkernel/intern/seqcache.c +++ b/source/blender/blenkernel/intern/seqcache.c @@ -69,58 +69,15 @@ static struct SeqPreprocessCache *preprocess_cache = NULL; static void preprocessed_cache_destruct(void); -static int seq_cmp_render_data(const SeqRenderData *a, const SeqRenderData *b) +static bool seq_cmp_render_data(const SeqRenderData *a, const SeqRenderData *b) { - if (a->preview_render_size < b->preview_render_size) { - return -1; - } - if (a->preview_render_size > b->preview_render_size) { - return 1; - } - - if (a->rectx < b->rectx) { - return -1; - } - if (a->rectx > b->rectx) { - return 1; - } - - if (a->recty < b->recty) { - return -1; - } - if (a->recty > b->recty) { - return 1; - } - - if (a->bmain < b->bmain) { - return -1; - } - if (a->bmain > b->bmain) { - return 1; - } - - if (a->scene < b->scene) { - return -1; - } - if (a->scene > b->scene) { - return 1; - } - - if (a->motion_blur_shutter < b->motion_blur_shutter) { - return -1; - } - if (a->motion_blur_shutter > b->motion_blur_shutter) { - return 1; - } - - if (a->motion_blur_samples < b->motion_blur_samples) { - return -1; - } - if (a->motion_blur_samples > b->motion_blur_samples) { - return 1; - } - - return 0; + return ((a->preview_render_size != b->preview_render_size) || + (a->rectx != b->rectx) || + (a->recty != b->recty) || + (a->bmain != b->bmain) || + (a->scene != b->scene) || + (a->motion_blur_shutter != b->motion_blur_shutter) || + (a->motion_blur_samples != b->motion_blur_samples)); } static unsigned int seq_hash_render_data(const SeqRenderData *a) @@ -148,33 +105,15 @@ static unsigned int seqcache_hashhash(const void *key_) return rval; } -static int seqcache_hashcmp(const void *a_, const void *b_) +static bool seqcache_hashcmp(const void *a_, const void *b_) { const SeqCacheKey *a = (SeqCacheKey *) a_; const SeqCacheKey *b = (SeqCacheKey *) b_; - if (a->seq < b->seq) { - return -1; - } - if (a->seq > b->seq) { - return 1; - } - - if (a->cfra < b->cfra) { - return -1; - } - if (a->cfra > b->cfra) { - return 1; - } - - if (a->type < b->type) { - return -1; - } - if (a->type > b->type) { - return 1; - } - - return seq_cmp_render_data(&a->context, &b->context); + return ((a->seq != b->seq) || + (a->cfra != b->cfra) || + (a->type != b->type) || + seq_cmp_render_data(&a->context, &b->context)); } void BKE_sequencer_cache_destruct(void) diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index a8e578eae0d..11a6cb7acc3 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -1322,7 +1322,7 @@ static float check_zone(WipeZone *wipezone, int x, int y, Sequence *seq, float f if (angle == 0.0f) { b1 = posy; b2 = y; - hyp = fabs(y - posy); + hyp = fabsf(y - posy); } else { b1 = posy - (-angle) * posx; @@ -1745,8 +1745,8 @@ static void transform_image(int x, int y, ImBuf *ibuf1, ImBuf *out, float scale yo = y; /* Rotate */ - s = sin(rotate); - c = cos(rotate); + s = sinf(rotate); + c = cosf(rotate); for (yi = 0; yi < yo; yi++) { for (xi = 0; xi < xo; xi++) { diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 9c411142566..13575560669 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -2160,7 +2160,7 @@ static void sb_spring_force(Object *ob, int bpi, BodySpring *bs, float iks, floa // dfdx_spring(ia, ia, op, dir, bs->len, distance, -mpos); /* depending on my vel */ // dfdv_goal(ia, ia, mvel); // well that ignores geometie - if (bp2->goal < SOFTGOALSNAP) { /* ommit this bp when it snaps */ + if (bp2->goal < SOFTGOALSNAP) { /* omit this bp when it snaps */ /* depending on other pos */ // dfdx_spring(ia, ic, op, dir, bs->len, distance, mpos); /* depending on other vel */ @@ -2257,7 +2257,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo } /* naive ball self collision done */ - if (_final_goal(ob, bp) < SOFTGOALSNAP) { /* ommit this bp when it snaps */ + if (_final_goal(ob, bp) < SOFTGOALSNAP) { /* omit this bp when it snaps */ float auxvect[3]; float velgoal[3]; @@ -2652,7 +2652,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa } /* naive ball self collision done */ - if (_final_goal(ob, bp) < SOFTGOALSNAP) { /* ommit this bp when it snaps */ + if (_final_goal(ob, bp) < SOFTGOALSNAP) { /* omit this bp when it snaps */ float auxvect[3]; float velgoal[3]; diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 4cd85fb342e..8a272cd9d81 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -267,16 +267,79 @@ static void cleanup_textline(TextLine *tl) tl->len += txt_extended_ascii_as_utf8(&tl->line); } +/** + * used for load and reload (unlike txt_insert_buf) + * assumes all fields are empty + */ +static void text_from_buf(Text *text, const unsigned char *buffer, const int len) +{ + int i, llen; + + BLI_assert(BLI_listbase_is_empty(&text->lines)); + + text->nlines = 0; + llen = 0; + for (i = 0; i < len; i++) { + if (buffer[i] == '\n') { + TextLine *tmp; + + tmp = (TextLine *) MEM_mallocN(sizeof(TextLine), "textline"); + tmp->line = (char *) MEM_mallocN(llen + 1, "textline_string"); + tmp->format = NULL; + + if (llen) memcpy(tmp->line, &buffer[i - llen], llen); + tmp->line[llen] = 0; + tmp->len = llen; + + cleanup_textline(tmp); + + BLI_addtail(&text->lines, tmp); + text->nlines++; + + llen = 0; + continue; + } + llen++; + } + + /* create new line in cases: + * - rest of line (if last line in file hasn't got \n terminator). + * in this case content of such line would be used to fill text line buffer + * - file is empty. in this case new line is needed to start editing from. + * - last characted in buffer is \n. in this case new line is needed to + * deal with newline at end of file. (see [#28087]) (sergey) */ + if (llen != 0 || text->nlines == 0 || buffer[len - 1] == '\n') { + TextLine *tmp; + + tmp = (TextLine *) MEM_mallocN(sizeof(TextLine), "textline"); + tmp->line = (char *) MEM_mallocN(llen + 1, "textline_string"); + tmp->format = NULL; + + if (llen) memcpy(tmp->line, &buffer[i - llen], llen); + + tmp->line[llen] = 0; + tmp->len = llen; + + cleanup_textline(tmp); + + BLI_addtail(&text->lines, tmp); + text->nlines++; + } + + text->curl = text->sell = text->lines.first; + text->curc = text->selc = 0; +} + int BKE_text_reload(Text *text) { FILE *fp; - int i, llen, len; + int len; unsigned char *buffer; TextLine *tmp; char str[FILE_MAX]; - struct stat st; + BLI_stat_t st; - if (!text || !text->name) return 0; + if (!text->name) return 0; BLI_strncpy(str, text->name, FILE_MAX); BLI_path_abs(str, G.main->name); @@ -299,13 +362,12 @@ int BKE_text_reload(Text *text) /* clear undo buffer */ MEM_freeN(text->undo_buf); init_undo_text(text); - + fseek(fp, 0L, SEEK_END); len = ftell(fp); fseek(fp, 0L, SEEK_SET); - text->undo_pos = -1; - + buffer = MEM_mallocN(len, "text_buffer"); // under windows fread can return less then len bytes because // of CR stripping @@ -313,51 +375,11 @@ int BKE_text_reload(Text *text) fclose(fp); - stat(str, &st); + BLI_stat(str, &st); text->mtime = st.st_mtime; - - text->nlines = 0; - llen = 0; - for (i = 0; i < len; i++) { - if (buffer[i] == '\n') { - tmp = (TextLine *) MEM_mallocN(sizeof(TextLine), "textline"); - tmp->line = (char *) MEM_mallocN(llen + 1, "textline_string"); - tmp->format = NULL; - - if (llen) memcpy(tmp->line, &buffer[i - llen], llen); - tmp->line[llen] = 0; - tmp->len = llen; - - cleanup_textline(tmp); - BLI_addtail(&text->lines, tmp); - text->nlines++; - - llen = 0; - continue; - } - llen++; - } + text_from_buf(text, buffer, len); - if (llen != 0 || text->nlines == 0) { - tmp = (TextLine *) MEM_mallocN(sizeof(TextLine), "textline"); - tmp->line = (char *) MEM_mallocN(llen + 1, "textline_string"); - tmp->format = NULL; - - if (llen) memcpy(tmp->line, &buffer[i - llen], llen); - - tmp->line[llen] = 0; - tmp->len = llen; - - cleanup_textline(tmp); - - BLI_addtail(&text->lines, tmp); - text->nlines++; - } - - text->curl = text->sell = text->lines.first; - text->curc = text->selc = 0; - MEM_freeN(buffer); return 1; } @@ -365,12 +387,11 @@ int BKE_text_reload(Text *text) Text *BKE_text_load_ex(Main *bmain, const char *file, const char *relpath, const bool is_internal) { FILE *fp; - int i, llen, len; + int len; unsigned char *buffer; - TextLine *tmp; Text *ta; char str[FILE_MAX]; - struct stat st; + BLI_stat_t st; BLI_strncpy(str, file, FILE_MAX); if (relpath) /* can be NULL (bg mode) */ @@ -388,10 +409,6 @@ Text *BKE_text_load_ex(Main *bmain, const char *file, const char *relpath, const if ((U.flag & USER_TXT_TABSTOSPACES_DISABLE) == 0) ta->flags = TXT_TABSTOSPACES; - fseek(fp, 0L, SEEK_END); - len = ftell(fp); - fseek(fp, 0L, SEEK_SET); - if (is_internal == false) { ta->name = MEM_mallocN(strlen(file) + 1, "text_name"); strcpy(ta->name, file); @@ -400,7 +417,12 @@ Text *BKE_text_load_ex(Main *bmain, const char *file, const char *relpath, const ta->flags |= TXT_ISMEM | TXT_ISDIRTY; } + /* clear undo buffer */ init_undo_text(ta); + + fseek(fp, 0L, SEEK_END); + len = ftell(fp); + fseek(fp, 0L, SEEK_SET); buffer = MEM_mallocN(len, "text_buffer"); // under windows fread can return less then len bytes because @@ -409,56 +431,10 @@ Text *BKE_text_load_ex(Main *bmain, const char *file, const char *relpath, const fclose(fp); - stat(str, &st); + BLI_stat(str, &st); ta->mtime = st.st_mtime; - ta->nlines = 0; - llen = 0; - for (i = 0; i < len; i++) { - if (buffer[i] == '\n') { - tmp = (TextLine *) MEM_mallocN(sizeof(TextLine), "textline"); - tmp->line = (char *) MEM_mallocN(llen + 1, "textline_string"); - tmp->format = NULL; - - if (llen) memcpy(tmp->line, &buffer[i - llen], llen); - tmp->line[llen] = 0; - tmp->len = llen; - - cleanup_textline(tmp); - - BLI_addtail(&ta->lines, tmp); - ta->nlines++; - - llen = 0; - continue; - } - llen++; - } - - /* create new line in cases: - * - rest of line (if last line in file hasn't got \n terminator). - * in this case content of such line would be used to fill text line buffer - * - file is empty. in this case new line is needed to start editing from. - * - last characted in buffer is \n. in this case new line is needed to - * deal with newline at end of file. (see [#28087]) (sergey) */ - if (llen != 0 || ta->nlines == 0 || buffer[len - 1] == '\n') { - tmp = (TextLine *) MEM_mallocN(sizeof(TextLine), "textline"); - tmp->line = (char *) MEM_mallocN(llen + 1, "textline_string"); - tmp->format = NULL; - - if (llen) memcpy(tmp->line, &buffer[i - llen], llen); - - tmp->line[llen] = 0; - tmp->len = llen; - - cleanup_textline(tmp); - - BLI_addtail(&ta->lines, tmp); - ta->nlines++; - } - - ta->curl = ta->sell = ta->lines.first; - ta->curc = ta->selc = 0; + text_from_buf(ta, buffer, len); MEM_freeN(buffer); @@ -671,7 +647,7 @@ int BKE_text_file_modified_check(Text *text) int result; char file[FILE_MAX]; - if (!text || !text->name) + if (!text->name) return 0; BLI_strncpy(file, text->name, FILE_MAX); @@ -700,7 +676,7 @@ void BKE_text_file_modified_ignore(Text *text) int result; char file[FILE_MAX]; - if (!text || !text->name) return; + if (!text->name) return; BLI_strncpy(file, text->name, FILE_MAX); BLI_path_abs(file, G.main->name); @@ -766,9 +742,7 @@ static TextLine *txt_new_linen(const char *str, int n) void txt_clean_text(Text *text) { TextLine **top, **bot; - - if (!text) return; - + if (!text->lines.first) { if (text->lines.last) text->lines.first = text->lines.last; else text->lines.first = text->lines.last = txt_new_line(NULL); @@ -907,8 +881,7 @@ void txt_move_up(Text *text, const bool sel) { TextLine **linep; int *charp; - - if (!text) return; + if (sel) txt_curs_sel(text, &linep, &charp); else { txt_pop_first(text); txt_curs_cur(text, &linep, &charp); } if (!*linep) return; @@ -930,8 +903,7 @@ void txt_move_down(Text *text, const bool sel) { TextLine **linep; int *charp; - - if (!text) return; + if (sel) txt_curs_sel(text, &linep, &charp); else { txt_pop_last(text); txt_curs_cur(text, &linep, &charp); } if (!*linep) return; @@ -953,8 +925,7 @@ void txt_move_left(Text *text, const bool sel) TextLine **linep; int *charp; int tabsize = 0, i = 0; - - if (!text) return; + if (sel) txt_curs_sel(text, &linep, &charp); else { txt_pop_first(text); txt_curs_cur(text, &linep, &charp); } if (!*linep) return; @@ -998,8 +969,7 @@ void txt_move_right(Text *text, const bool sel) TextLine **linep; int *charp, i; bool do_tab = false; - - if (!text) return; + if (sel) txt_curs_sel(text, &linep, &charp); else { txt_pop_last(text); txt_curs_cur(text, &linep, &charp); } if (!*linep) return; @@ -1040,8 +1010,7 @@ void txt_jump_left(Text *text, const bool sel, const bool use_init_step) { TextLine **linep; int *charp; - - if (!text) return; + if (sel) txt_curs_sel(text, &linep, &charp); else { txt_pop_first(text); txt_curs_cur(text, &linep, &charp); } if (!*linep) return; @@ -1057,8 +1026,7 @@ void txt_jump_right(Text *text, const bool sel, const bool use_init_step) { TextLine **linep; int *charp; - - if (!text) return; + if (sel) txt_curs_sel(text, &linep, &charp); else { txt_pop_last(text); txt_curs_cur(text, &linep, &charp); } if (!*linep) return; @@ -1074,8 +1042,7 @@ void txt_move_bol(Text *text, const bool sel) { TextLine **linep; int *charp; - - if (!text) return; + if (sel) txt_curs_sel(text, &linep, &charp); else txt_curs_cur(text, &linep, &charp); if (!*linep) return; @@ -1089,8 +1056,7 @@ void txt_move_eol(Text *text, const bool sel) { TextLine **linep; int *charp; - - if (!text) return; + if (sel) txt_curs_sel(text, &linep, &charp); else txt_curs_cur(text, &linep, &charp); if (!*linep) return; @@ -1104,8 +1070,7 @@ void txt_move_bof(Text *text, const bool sel) { TextLine **linep; int *charp; - - if (!text) return; + if (sel) txt_curs_sel(text, &linep, &charp); else txt_curs_cur(text, &linep, &charp); if (!*linep) return; @@ -1120,8 +1085,7 @@ void txt_move_eof(Text *text, const bool sel) { TextLine **linep; int *charp; - - if (!text) return; + if (sel) txt_curs_sel(text, &linep, &charp); else txt_curs_cur(text, &linep, &charp); if (!*linep) return; @@ -1143,8 +1107,7 @@ void txt_move_to(Text *text, unsigned int line, unsigned int ch, const bool sel) TextLine **linep; int *charp; unsigned int i; - - if (!text) return; + if (sel) txt_curs_sel(text, &linep, &charp); else txt_curs_cur(text, &linep, &charp); if (!*linep) return; @@ -1181,7 +1144,6 @@ static void txt_curs_swap(Text *text) static void txt_pop_first(Text *text) { - if (txt_get_span(text->curl, text->sell) < 0 || (text->curl == text->sell && text->curc > text->selc)) { @@ -1210,7 +1172,6 @@ void txt_pop_sel(Text *text) void txt_order_cursors(Text *text, const bool reverse) { - if (!text) return; if (!text->curl) return; if (!text->sell) return; @@ -1240,8 +1201,7 @@ static void txt_delete_sel(Text *text) { TextLine *tmpl; char *buf; - - if (!text) return; + if (!text->curl) return; if (!text->sell) return; @@ -1277,8 +1237,6 @@ static void txt_delete_sel(Text *text) void txt_sel_all(Text *text) { - if (!text) return; - text->curl = text->lines.first; text->curc = 0; @@ -1301,7 +1259,6 @@ void txt_sel_clear(Text *text) void txt_sel_line(Text *text) { - if (!text) return; if (!text->curl) return; text->curc = 0; @@ -1319,8 +1276,7 @@ char *txt_to_buf(Text *text) TextLine *tmp, *linef, *linel; int charf, charl; char *buf; - - if (!text) return NULL; + if (!text->curl) return NULL; if (!text->sell) return NULL; if (!text->lines.first) return NULL; @@ -1382,7 +1338,7 @@ int txt_find_string(Text *text, const char *findstr, int wrap, int match_case) TextLine *tl, *startl; const char *s = NULL; - if (!text || !text->curl || !text->sell) return 0; + if (!text->curl || !text->sell) return 0; txt_order_cursors(text, false); @@ -1422,8 +1378,7 @@ char *txt_sel_to_buf(Text *text) int length = 0; TextLine *tmp, *linef, *linel; int charf, charl; - - if (!text) return NULL; + if (!text->curl) return NULL; if (!text->sell) return NULL; @@ -1504,7 +1459,6 @@ void txt_insert_buf(Text *text, const char *in_buffer) TextLine *add; char *buffer; - if (!text) return; if (!in_buffer) return; txt_delete_sel(text); @@ -2386,8 +2340,7 @@ void txt_split_curline(Text *text) { TextLine *ins; char *left, *right; - - if (!text) return; + if (!text->curl) return; txt_delete_sel(text); @@ -2429,7 +2382,6 @@ void txt_split_curline(Text *text) static void txt_delete_line(Text *text, TextLine *line) { - if (!text) return; if (!text->curl) return; BLI_remlink(&text->lines, line); @@ -2446,8 +2398,6 @@ static void txt_delete_line(Text *text, TextLine *line) static void txt_combine_lines(Text *text, TextLine *linea, TextLine *lineb) { char *tmp, *s; - - if (!text) return; if (!linea || !lineb) return; @@ -2471,7 +2421,7 @@ void txt_duplicate_line(Text *text) { TextLine *textline; - if (!text || !text->curl) return; + if (!text->curl) return; if (text->curl == text->sell) { textline = txt_new_line(text->curl->line); @@ -2487,8 +2437,7 @@ void txt_duplicate_line(Text *text) void txt_delete_char(Text *text) { unsigned int c = '\n'; - - if (!text) return; + if (!text->curl) return; if (txt_has_sel(text)) { /* deleting a selection */ @@ -2531,7 +2480,6 @@ void txt_backspace_char(Text *text) { unsigned int c = '\n'; - if (!text) return; if (!text->curl) return; if (txt_has_sel(text)) { /* deleting a selection */ @@ -2595,8 +2543,7 @@ static bool txt_add_char_intern(Text *text, unsigned int add, bool replace_tabs) { char *tmp, ch[BLI_UTF8_MAX]; size_t add_len; - - if (!text) return 0; + if (!text->curl) return 0; if (add == '\n') { @@ -2655,8 +2602,7 @@ bool txt_replace_char(Text *text, unsigned int add) unsigned int del; size_t del_size = 0, add_size; char ch[BLI_UTF8_MAX]; - - if (!text) return 0; + if (!text->curl) return 0; /* If text is selected or we're at the end of the line just use txt_add_char */ @@ -2710,7 +2656,7 @@ void txt_indent(Text *text) /* hardcoded: TXT_TABSIZE = 4 spaces: */ int spaceslen = TXT_TABSIZE; - if (ELEM(NULL, text, text->curl, text->sell)) { + if (ELEM(NULL, text->curl, text->sell)) { return; } @@ -2777,7 +2723,7 @@ void txt_unindent(Text *text) /* hardcoded: TXT_TABSIZE = 4 spaces: */ int spaceslen = TXT_TABSIZE; - if (ELEM(NULL, text, text->curl, text->sell)) { + if (ELEM(NULL, text->curl, text->sell)) { return; } @@ -2830,8 +2776,7 @@ void txt_comment(Text *text) int len, num; char *tmp; char add = '#'; - - if (!text) return; + if (!text->curl) return; if (!text->sell) return; // Need to change this need to check if only one line is selected to more than one @@ -2878,8 +2823,7 @@ void txt_uncomment(Text *text) { int num = 0; char remove = '#'; - - if (!text) return; + if (!text->curl) return; if (!text->sell) return; @@ -2925,7 +2869,7 @@ void txt_move_lines(struct Text *text, const int direction) BLI_assert(ELEM(direction, TXT_MOVE_LINE_UP, TXT_MOVE_LINE_DOWN)); - if (!text || !text->curl || !text->sell) return; + if (!text->curl || !text->sell) return; txt_order_cursors(text, false); @@ -2958,6 +2902,7 @@ int txt_setcurr_tab_spaces(Text *text, int space) const char *comm = "#"; const char indent = (text->flags & TXT_TABSTOSPACES) ? ' ' : '\t'; static const char *back_words[] = {"return", "break", "continue", "pass", "yield", NULL}; + if (!text->curl) return 0; while (text->curl->line[i] == indent) { diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index b77cd744a18..40d9dc0d7e0 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -371,6 +371,9 @@ void BKE_tracking_clipboard_paste_tracks(MovieTracking *tracking, MovieTrackingO while (track) { MovieTrackingTrack *new_track = BKE_tracking_track_duplicate(track); + if (track->prev == NULL) { + tracking->act_track = new_track; + } BLI_addtail(tracksbase, new_track); BKE_tracking_track_unique_name(tracksbase, new_track); @@ -1789,13 +1792,19 @@ ImBuf *BKE_tracking_distortion_exec(MovieDistortion *distortion, MovieTracking * if (ibuf->rect_float) { if (undistort) { libmv_cameraIntrinsicsUndistortFloat(distortion->intrinsics, - ibuf->rect_float, resibuf->rect_float, - ibuf->x, ibuf->y, overscan, ibuf->channels); + ibuf->rect_float, + ibuf->x, ibuf->y, + overscan, + ibuf->channels, + resibuf->rect_float); } else { libmv_cameraIntrinsicsDistortFloat(distortion->intrinsics, - ibuf->rect_float, resibuf->rect_float, - ibuf->x, ibuf->y, overscan, ibuf->channels); + ibuf->rect_float, + ibuf->x, ibuf->y, + overscan, + ibuf->channels, + resibuf->rect_float); } if (ibuf->rect) @@ -1804,13 +1813,19 @@ ImBuf *BKE_tracking_distortion_exec(MovieDistortion *distortion, MovieTracking * else { if (undistort) { libmv_cameraIntrinsicsUndistortByte(distortion->intrinsics, - (unsigned char *)ibuf->rect, (unsigned char *)resibuf->rect, - ibuf->x, ibuf->y, overscan, ibuf->channels); + (unsigned char *)ibuf->rect, + ibuf->x, ibuf->y, + overscan, + ibuf->channels, + (unsigned char *)resibuf->rect); } else { libmv_cameraIntrinsicsDistortByte(distortion->intrinsics, - (unsigned char *)ibuf->rect, (unsigned char *)resibuf->rect, - ibuf->x, ibuf->y, overscan, ibuf->channels); + (unsigned char *)ibuf->rect, + ibuf->x, ibuf->y, + overscan, + ibuf->channels, + (unsigned char *)resibuf->rect); } } @@ -2017,14 +2032,14 @@ ImBuf *BKE_tracking_sample_pattern(int frame_width, int frame_height, ImBuf *sea } if (search_ibuf->rect_float) { - libmv_samplePlanarPatch(search_ibuf->rect_float, - search_ibuf->x, search_ibuf->y, 4, - src_pixel_x, src_pixel_y, - num_samples_x, num_samples_y, - mask, - pattern_ibuf->rect_float, - &warped_position_x, - &warped_position_y); + libmv_samplePlanarPatchFloat(search_ibuf->rect_float, + search_ibuf->x, search_ibuf->y, 4, + src_pixel_x, src_pixel_y, + num_samples_x, num_samples_y, + mask, + pattern_ibuf->rect_float, + &warped_position_x, + &warped_position_y); } else { libmv_samplePlanarPatchByte((unsigned char *) search_ibuf->rect, @@ -2185,10 +2200,10 @@ void BKE_tracking_disable_channels(ImBuf *ibuf, bool disable_red, bool disable_g /* ** Channels sort comparators ** */ -static int channels_alpha_sort(void *a, void *b) +static int channels_alpha_sort(const void *a, const void *b) { - MovieTrackingDopesheetChannel *channel_a = a; - MovieTrackingDopesheetChannel *channel_b = b; + const MovieTrackingDopesheetChannel *channel_a = a; + const MovieTrackingDopesheetChannel *channel_b = b; if (BLI_strcasecmp(channel_a->track->name, channel_b->track->name) > 0) return 1; @@ -2196,10 +2211,10 @@ static int channels_alpha_sort(void *a, void *b) return 0; } -static int channels_total_track_sort(void *a, void *b) +static int channels_total_track_sort(const void *a, const void *b) { - MovieTrackingDopesheetChannel *channel_a = a; - MovieTrackingDopesheetChannel *channel_b = b; + const MovieTrackingDopesheetChannel *channel_a = a; + const MovieTrackingDopesheetChannel *channel_b = b; if (channel_a->total_frames > channel_b->total_frames) return 1; @@ -2207,10 +2222,10 @@ static int channels_total_track_sort(void *a, void *b) return 0; } -static int channels_longest_segment_sort(void *a, void *b) +static int channels_longest_segment_sort(const void *a, const void *b) { - MovieTrackingDopesheetChannel *channel_a = a; - MovieTrackingDopesheetChannel *channel_b = b; + const MovieTrackingDopesheetChannel *channel_a = a; + const MovieTrackingDopesheetChannel *channel_b = b; if (channel_a->max_segment > channel_b->max_segment) return 1; @@ -2218,10 +2233,10 @@ static int channels_longest_segment_sort(void *a, void *b) return 0; } -static int channels_average_error_sort(void *a, void *b) +static int channels_average_error_sort(const void *a, const void *b) { - MovieTrackingDopesheetChannel *channel_a = a; - MovieTrackingDopesheetChannel *channel_b = b; + const MovieTrackingDopesheetChannel *channel_a = a; + const MovieTrackingDopesheetChannel *channel_b = b; if (channel_a->track->error > channel_b->track->error) return 1; @@ -2229,7 +2244,7 @@ static int channels_average_error_sort(void *a, void *b) return 0; } -static int channels_alpha_inverse_sort(void *a, void *b) +static int channels_alpha_inverse_sort(const void *a, const void *b) { if (channels_alpha_sort(a, b)) return 0; @@ -2237,7 +2252,7 @@ static int channels_alpha_inverse_sort(void *a, void *b) return 1; } -static int channels_total_track_inverse_sort(void *a, void *b) +static int channels_total_track_inverse_sort(const void *a, const void *b) { if (channels_total_track_sort(a, b)) return 0; @@ -2245,7 +2260,7 @@ static int channels_total_track_inverse_sort(void *a, void *b) return 1; } -static int channels_longest_segment_inverse_sort(void *a, void *b) +static int channels_longest_segment_inverse_sort(const void *a, const void *b) { if (channels_longest_segment_sort(a, b)) return 0; @@ -2253,10 +2268,10 @@ static int channels_longest_segment_inverse_sort(void *a, void *b) return 1; } -static int channels_average_error_inverse_sort(void *a, void *b) +static int channels_average_error_inverse_sort(const void *a, const void *b) { - MovieTrackingDopesheetChannel *channel_a = a; - MovieTrackingDopesheetChannel *channel_b = b; + const MovieTrackingDopesheetChannel *channel_a = a; + const MovieTrackingDopesheetChannel *channel_b = b; if (channel_a->track->error < channel_b->track->error) return 1; diff --git a/source/blender/blenkernel/intern/treehash.c b/source/blender/blenkernel/intern/treehash.c index a65bd28da97..866502c4ae1 100644 --- a/source/blender/blenkernel/intern/treehash.c +++ b/source/blender/blenkernel/intern/treehash.c @@ -91,7 +91,7 @@ static unsigned int tse_hash(const void *ptr) return hash.u_int; } -static int tse_cmp(const void *a, const void *b) +static bool tse_cmp(const void *a, const void *b) { const TreeStoreElem *tse_a = a; const TreeStoreElem *tse_b = b; diff --git a/source/blender/blenlib/BLI_array.h b/source/blender/blenlib/BLI_array.h index 3a9d013f796..db33c5cec8b 100644 --- a/source/blender/blenlib/BLI_array.h +++ b/source/blender/blenlib/BLI_array.h @@ -84,26 +84,30 @@ void _bli_array_grow_func(void **arr_p, const void *arr_static, * * Allow for a large 'num' value when the new size is more than double * to allocate the exact sized array. */ -#define BLI_array_grow_items(arr, num) (( \ +#define BLI_array_reserve(arr, num) (void)( \ (((void *)(arr) == NULL) && \ ((void *)(_##arr##_static) != NULL) && \ /* don't add _##arr##_count below because it must be zero */ \ - (_bli_array_totalsize_static(arr) >= _##arr##_count + num)) ? \ + (_bli_array_totalsize_static(arr) >= _##arr##_count + (num))) ? \ /* we have an empty array and a static var big enough */ \ (void)(arr = (void *)_##arr##_static) \ : \ /* use existing static array or allocate */ \ - (LIKELY(_bli_array_totalsize(arr) >= _##arr##_count + num) ? \ + (LIKELY(_bli_array_totalsize(arr) >= _##arr##_count + (num)) ? \ (void)0 /* do nothing */ : \ _bli_array_grow_func((void **)&(arr), _##arr##_static, \ sizeof(*(arr)), _##arr##_count, num, \ "BLI_array." #arr)) \ - ), \ - /* increment the array count, all conditions above are accounted for. */ \ - (_##arr##_count += num)) + ) + /* returns length of array */ -#define BLI_array_grow_one(arr) BLI_array_grow_items(arr, 1) + +#define BLI_array_grow_items(arr, num) \ + (BLI_array_reserve(arr, num), (_##arr##_count += num)) + +#define BLI_array_grow_one(arr) \ + BLI_array_grow_items(arr, 1) /* appends an item to the array. */ @@ -120,9 +124,9 @@ void _bli_array_grow_func(void **arr_p, const void *arr_static, (&arr[_##arr##_count - 1]) \ ) -#define BLI_array_reserve(arr, num) \ - BLI_array_grow_items(arr, num), (void)(_##arr##_count -= (num)) - +/* appends (grows) & returns a pointer to the uninitialized memory */ +#define BLI_array_append_ret(arr) \ + (BLI_array_reserve(arr, 1), &arr[(_##arr##_count++)]) #define BLI_array_free(arr) \ if (arr && (char *)arr != _##arr##_static) { \ diff --git a/source/blender/blenlib/BLI_compiler_typecheck.h b/source/blender/blenlib/BLI_compiler_typecheck.h new file mode 100644 index 00000000000..551569b066d --- /dev/null +++ b/source/blender/blenlib/BLI_compiler_typecheck.h @@ -0,0 +1,379 @@ +/* + * ***** 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. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef __BLI_COMPILER_TYPECHECK_H__ +#define __BLI_COMPILER_TYPECHECK_H__ + +/** \file BLI_compiler_typecheck.h + * \ingroup bli + * + * Type checking macros (often used to ensure valid use of macro args). + * These depend on compiler extensions and c11 in some cases. + */ + +/* Causes warning: + * incompatible types when assigning to type 'Foo' from type 'Bar' + * ... the compiler optimizes away the temp var */ +#ifdef __GNUC__ +#define CHECK_TYPE(var, type) { \ + typeof(var) *__tmp; \ + __tmp = (type *)NULL; \ + (void)__tmp; \ +} (void)0 + +#define CHECK_TYPE_PAIR(var_a, var_b) { \ + typeof(var_a) *__tmp; \ + __tmp = (typeof(var_b) *)NULL; \ + (void)__tmp; \ +} (void)0 + +#define CHECK_TYPE_PAIR_INLINE(var_a, var_b) ((void)({ \ + typeof(var_a) *__tmp; \ + __tmp = (typeof(var_b) *)NULL; \ + (void)__tmp; \ +})) + +#else +# define CHECK_TYPE(var, type) +# define CHECK_TYPE_PAIR(var_a, var_b) +# define CHECK_TYPE_PAIR_INLINE(var_a, var_b) (void)0 +#endif + +/* can be used in simple macros */ +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) +# define CHECK_TYPE_INLINE(val, type) \ + (void)((void)(((type)0) != (0 ? (val) : ((type)0))), \ + _Generic((val), type: 0, const type: 0)) +#else +# define CHECK_TYPE_INLINE(val, type) \ + ((void)(((type)0) != (0 ? (val) : ((type)0)))) +#endif + +#define CHECK_TYPE_NONCONST(var) { \ + void *non_const = 0 ? (var) : NULL; \ + (void)non_const; \ +} (void)0 + +/** + * CHECK_TYPE_ANY: handy macro, eg: + * ``CHECK_TYPE_ANY(var, Foo *, Bar *, Baz *)`` + * + * excuse ridiculously long generated args. + * <pre> + * for i in range(63): + * args = [(chr(ord('a') + (c % 26)) + (chr(ord('0') + (c // 26)))) for c in range(i + 1)] + * print("#define _VA_CHECK_TYPE_ANY%d(v, %s) \\" % (i + 2, ", ".join(args))) + * print(" ((void)_Generic((v), %s))" % (": 0, ".join(args) + ": 0")) + * </pre> + */ +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) + +#define _VA_CHECK_TYPE_ANY2(v, a0) \ + ((void)_Generic((v), a0: 0)) +#define _VA_CHECK_TYPE_ANY3(v, a0, b0) \ + ((void)_Generic((v), a0: 0, b0: 0)) +#define _VA_CHECK_TYPE_ANY4(v, a0, b0, c0) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0)) +#define _VA_CHECK_TYPE_ANY5(v, a0, b0, c0, d0) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0)) +#define _VA_CHECK_TYPE_ANY6(v, a0, b0, c0, d0, e0) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0)) +#define _VA_CHECK_TYPE_ANY7(v, a0, b0, c0, d0, e0, f0) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0)) +#define _VA_CHECK_TYPE_ANY8(v, a0, b0, c0, d0, e0, f0, g0) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0)) +#define _VA_CHECK_TYPE_ANY9(v, a0, b0, c0, d0, e0, f0, g0, h0) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0)) +#define _VA_CHECK_TYPE_ANY10(v, a0, b0, c0, d0, e0, f0, g0, h0, i0) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0)) +#define _VA_CHECK_TYPE_ANY11(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0)) +#define _VA_CHECK_TYPE_ANY12(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0)) +#define _VA_CHECK_TYPE_ANY13(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0)) +#define _VA_CHECK_TYPE_ANY14(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0)) +#define _VA_CHECK_TYPE_ANY15(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0)) +#define _VA_CHECK_TYPE_ANY16(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0)) +#define _VA_CHECK_TYPE_ANY17(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0)) +#define _VA_CHECK_TYPE_ANY18(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0)) +#define _VA_CHECK_TYPE_ANY19(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0)) +#define _VA_CHECK_TYPE_ANY20(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0)) +#define _VA_CHECK_TYPE_ANY21(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0)) +#define _VA_CHECK_TYPE_ANY22(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0)) +#define _VA_CHECK_TYPE_ANY23(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0)) +#define _VA_CHECK_TYPE_ANY24(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0)) +#define _VA_CHECK_TYPE_ANY25(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0, x0) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0)) +#define _VA_CHECK_TYPE_ANY26(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0, x0, y0) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0)) +#define _VA_CHECK_TYPE_ANY27(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0, x0, y0, z0) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0)) +#define _VA_CHECK_TYPE_ANY28(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0, x0, y0, z0, a1) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0)) +#define _VA_CHECK_TYPE_ANY29(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0, x0, y0, z0, a1, b1) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0)) +#define _VA_CHECK_TYPE_ANY30(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0, x0, y0, z0, a1, b1, c1) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0)) +#define _VA_CHECK_TYPE_ANY31(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0, x0, y0, z0, a1, b1, c1, d1) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ + d1: 0)) +#define _VA_CHECK_TYPE_ANY32(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0, x0, y0, z0, a1, b1, c1, d1, e1) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ + d1: 0, e1: 0)) +#define _VA_CHECK_TYPE_ANY33(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ + d1: 0, e1: 0, f1: 0)) +#define _VA_CHECK_TYPE_ANY34(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ + d1: 0, e1: 0, f1: 0, g1: 0)) +#define _VA_CHECK_TYPE_ANY35(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ + d1: 0, e1: 0, f1: 0, g1: 0, h1: 0)) +#define _VA_CHECK_TYPE_ANY36(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ + d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0)) +#define _VA_CHECK_TYPE_ANY37(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ + d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0)) +#define _VA_CHECK_TYPE_ANY38(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ + d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0)) +#define _VA_CHECK_TYPE_ANY39(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ + d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0)) +#define _VA_CHECK_TYPE_ANY40(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ + d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0)) +#define _VA_CHECK_TYPE_ANY41(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ + d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0)) +#define _VA_CHECK_TYPE_ANY42(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ + d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0)) +#define _VA_CHECK_TYPE_ANY43(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ + d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0)) +#define _VA_CHECK_TYPE_ANY44(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ + d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0)) +#define _VA_CHECK_TYPE_ANY45(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ + d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0)) +#define _VA_CHECK_TYPE_ANY46(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ + d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0)) +#define _VA_CHECK_TYPE_ANY47(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ + d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \ + t1: 0)) +#define _VA_CHECK_TYPE_ANY48(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ + d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \ + t1: 0, u1: 0)) +#define _VA_CHECK_TYPE_ANY49(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ + d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \ + t1: 0, u1: 0, v1: 0)) +#define _VA_CHECK_TYPE_ANY50(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ + d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \ + t1: 0, u1: 0, v1: 0, w1: 0)) +#define _VA_CHECK_TYPE_ANY51(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \ + x1) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ + d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \ + t1: 0, u1: 0, v1: 0, w1: 0, x1: 0)) +#define _VA_CHECK_TYPE_ANY52(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \ + x1, y1) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ + d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \ + t1: 0, u1: 0, v1: 0, w1: 0, x1: 0, y1: 0)) +#define _VA_CHECK_TYPE_ANY53(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \ + x1, y1, z1) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ + d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \ + t1: 0, u1: 0, v1: 0, w1: 0, x1: 0, y1: 0, z1: 0)) +#define _VA_CHECK_TYPE_ANY54(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \ + x1, y1, z1, a2) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ + d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \ + t1: 0, u1: 0, v1: 0, w1: 0, x1: 0, y1: 0, z1: 0, a2: 0)) +#define _VA_CHECK_TYPE_ANY55(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \ + x1, y1, z1, a2, b2) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ + d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \ + t1: 0, u1: 0, v1: 0, w1: 0, x1: 0, y1: 0, z1: 0, a2: 0, b2: 0)) +#define _VA_CHECK_TYPE_ANY56(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \ + x1, y1, z1, a2, b2, c2) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ + d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \ + t1: 0, u1: 0, v1: 0, w1: 0, x1: 0, y1: 0, z1: 0, a2: 0, b2: 0, c2: 0)) +#define _VA_CHECK_TYPE_ANY57(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \ + x1, y1, z1, a2, b2, c2, d2) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ + d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \ + t1: 0, u1: 0, v1: 0, w1: 0, x1: 0, y1: 0, z1: 0, a2: 0, b2: 0, c2: 0, d2: 0)) +#define _VA_CHECK_TYPE_ANY58(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \ + x1, y1, z1, a2, b2, c2, d2, e2) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ + d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \ + t1: 0, u1: 0, v1: 0, w1: 0, x1: 0, y1: 0, z1: 0, a2: 0, b2: 0, c2: 0, d2: 0, e2: 0)) +#define _VA_CHECK_TYPE_ANY59(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \ + x1, y1, z1, a2, b2, c2, d2, e2, f2) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ + d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \ + t1: 0, u1: 0, v1: 0, w1: 0, x1: 0, y1: 0, z1: 0, a2: 0, b2: 0, c2: 0, d2: 0, e2: 0, f2: 0)) +#define _VA_CHECK_TYPE_ANY60(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \ + x1, y1, z1, a2, b2, c2, d2, e2, f2, g2) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ + d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \ + t1: 0, u1: 0, v1: 0, w1: 0, x1: 0, y1: 0, z1: 0, a2: 0, b2: 0, c2: 0, d2: 0, e2: 0, f2: 0, g2: 0)) +#define _VA_CHECK_TYPE_ANY61(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \ + x1, y1, z1, a2, b2, c2, d2, e2, f2, g2, h2) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ + d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \ + t1: 0, u1: 0, v1: 0, w1: 0, x1: 0, y1: 0, z1: 0, a2: 0, b2: 0, c2: 0, d2: 0, e2: 0, f2: 0, g2: 0, h2: 0)) +#define _VA_CHECK_TYPE_ANY62(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \ + x1, y1, z1, a2, b2, c2, d2, e2, f2, g2, h2, i2) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ + d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \ + t1: 0, u1: 0, v1: 0, w1: 0, x1: 0, y1: 0, z1: 0, a2: 0, b2: 0, c2: 0, d2: 0, e2: 0, f2: 0, g2: 0, h2: 0, i2: 0)) +#define _VA_CHECK_TYPE_ANY63(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \ + x1, y1, z1, a2, b2, c2, d2, e2, f2, g2, h2, i2, j2) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ + d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \ + t1: 0, u1: 0, v1: 0, w1: 0, x1: 0, y1: 0, z1: 0, a2: 0, b2: 0, c2: 0, d2: 0, e2: 0, f2: 0, g2: 0, h2: 0, i2: 0, \ + j2: 0)) +#define _VA_CHECK_TYPE_ANY64(v, a0, b0, c0, d0, e0, f0, g0, h0, i0, j0, k0, l0, m0, n0, o0, p0, q0, r0, s0, t0, u0, \ + v0, w0, x0, y0, z0, a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, \ + x1, y1, z1, a2, b2, c2, d2, e2, f2, g2, h2, i2, j2, k2) \ + ((void)_Generic((v), a0: 0, b0: 0, c0: 0, d0: 0, e0: 0, f0: 0, g0: 0, h0: 0, i0: 0, j0: 0, k0: 0, l0: 0, m0: 0, \ + n0: 0, o0: 0, p0: 0, q0: 0, r0: 0, s0: 0, t0: 0, u0: 0, v0: 0, w0: 0, x0: 0, y0: 0, z0: 0, a1: 0, b1: 0, c1: 0, \ + d1: 0, e1: 0, f1: 0, g1: 0, h1: 0, i1: 0, j1: 0, k1: 0, l1: 0, m1: 0, n1: 0, o1: 0, p1: 0, q1: 0, r1: 0, s1: 0, \ + t1: 0, u1: 0, v1: 0, w1: 0, x1: 0, y1: 0, z1: 0, a2: 0, b2: 0, c2: 0, d2: 0, e2: 0, f2: 0, g2: 0, h2: 0, i2: 0, \ + j2: 0, k2: 0)) +# define CHECK_TYPE_ANY(...) VA_NARGS_CALL_OVERLOAD(_VA_CHECK_TYPE_ANY, __VA_ARGS__) +#else +# define CHECK_TYPE_ANY(...) (void)0 +#endif + +#endif /* __BLI_COMPILER_TYPECHECK_H__ */ diff --git a/source/blender/blenlib/BLI_ghash.h b/source/blender/blenlib/BLI_ghash.h index dd3f62cd6d3..af2605894e3 100644 --- a/source/blender/blenlib/BLI_ghash.h +++ b/source/blender/blenlib/BLI_ghash.h @@ -41,7 +41,7 @@ extern "C" { #endif typedef unsigned int (*GHashHashFP) (const void *key); -typedef int (*GHashCmpFP) (const void *a, const void *b); +typedef bool (*GHashCmpFP) (const void *a, const void *b); typedef void (*GHashKeyFreeFP) (void *key); typedef void (*GHashValFreeFP) (void *val); @@ -120,14 +120,14 @@ BLI_INLINE bool BLI_ghashIterator_done(GHashIterator *ghi) { return !ghi * \{ */ unsigned int BLI_ghashutil_ptrhash(const void *key); -int BLI_ghashutil_ptrcmp(const void *a, const void *b); +bool BLI_ghashutil_ptrcmp(const void *a, const void *b); unsigned int BLI_ghashutil_strhash_n(const char *key, size_t n); #define BLI_ghashutil_strhash(key) ( \ CHECK_TYPE_INLINE(key, char *), \ BLI_ghashutil_strhash_p(key)) unsigned int BLI_ghashutil_strhash_p(const void *key); -int BLI_ghashutil_strcmp(const void *a, const void *b); +bool BLI_ghashutil_strcmp(const void *a, const void *b); #define BLI_ghashutil_inthash(key) ( \ CHECK_TYPE_INLINE(&(key), int *), \ @@ -139,11 +139,11 @@ unsigned int BLI_ghashutil_uinthash(unsigned int key); unsigned int BLI_ghashutil_uinthash_v4(const unsigned int key[4]); #define BLI_ghashutil_inthash_v4_p \ ((GSetHashFP)BLI_ghashutil_uinthash_v4) -int BLI_ghashutil_uinthash_v4_cmp(const void *a, const void *b); +bool BLI_ghashutil_uinthash_v4_cmp(const void *a, const void *b); #define BLI_ghashutil_inthash_v4_cmp \ BLI_ghashutil_uinthash_v4_cmp unsigned int BLI_ghashutil_inthash_p(const void *ptr); -int BLI_ghashutil_intcmp(const void *a, const void *b); +bool BLI_ghashutil_intcmp(const void *a, const void *b); /** \} */ @@ -167,7 +167,7 @@ typedef struct GHashPair { GHashPair *BLI_ghashutil_pairalloc(const void *first, const void *second); unsigned int BLI_ghashutil_pairhash(const void *ptr); -int BLI_ghashutil_paircmp(const void *a, const void *b); +bool BLI_ghashutil_paircmp(const void *a, const void *b); void BLI_ghashutil_pairfree(void *ptr); diff --git a/source/blender/blenlib/BLI_kdopbvh.h b/source/blender/blenlib/BLI_kdopbvh.h index 99a5fad397a..49d072ddfdc 100644 --- a/source/blender/blenlib/BLI_kdopbvh.h +++ b/source/blender/blenlib/BLI_kdopbvh.h @@ -89,7 +89,7 @@ void BLI_bvhtree_insert(BVHTree *tree, int index, const float co[3], int numpoin void BLI_bvhtree_balance(BVHTree *tree); /* update: first update points/nodes, then call update_tree to refit the bounding volumes */ -int BLI_bvhtree_update_node(BVHTree *tree, int index, const float co[3], const float co_moving[3], int numpoints); +bool BLI_bvhtree_update_node(BVHTree *tree, int index, const float co[3], const float co_moving[3], int numpoints); void BLI_bvhtree_update_tree(BVHTree *tree); /* collision/overlap: check two trees if they overlap, alloc's *overlap with length of the int return value */ diff --git a/source/blender/blenlib/BLI_listbase.h b/source/blender/blenlib/BLI_listbase.h index 697ba863603..fb388977ddf 100644 --- a/source/blender/blenlib/BLI_listbase.h +++ b/source/blender/blenlib/BLI_listbase.h @@ -67,8 +67,8 @@ void *BLI_poptail(ListBase *listbase) ATTR_NONNULL(1); void BLI_addhead(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1); void BLI_insertlinkbefore(struct ListBase *listbase, void *vnextlink, void *vnewlink) ATTR_NONNULL(1); void BLI_insertlinkafter(struct ListBase *listbase, void *vprevlink, void *vnewlink) ATTR_NONNULL(1); -void BLI_sortlist(struct ListBase *listbase, int (*cmp)(void *, void *)) ATTR_NONNULL(1, 2); -void BLI_sortlist_r(ListBase *listbase, void *thunk, int (*cmp)(void *, void *, void *)) ATTR_NONNULL(1, 3); +void BLI_sortlist(struct ListBase *listbase, int (*cmp)(const void *, const void *)) ATTR_NONNULL(1, 2); +void BLI_sortlist_r(ListBase *listbase, void *thunk, int (*cmp)(void *, const void *, const void *)) ATTR_NONNULL(1, 3); void BLI_freelist(struct ListBase *listbase) ATTR_NONNULL(1); int BLI_countlist(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); void BLI_freelinkN(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1); diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h index 5f94f04e0a8..494bc4083ba 100644 --- a/source/blender/blenlib/BLI_math_base.h +++ b/source/blender/blenlib/BLI_math_base.h @@ -83,8 +83,8 @@ static const int NAN_INT = 0x7FC00000; # define NAN_FLT (*((float *)(&NAN_INT))) #endif -/* do not redefine functions from C99 or POSIX.1-2001 */ -#if !(defined(_ISOC99_SOURCE) || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L)) +/* do not redefine functions from C99, POSIX.1-2001 or MSVC12 (partial C99) */ +#if !(defined(_ISOC99_SOURCE) || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L) || (defined(_MSC_VER) && _MSC_VER >= 1800)) #ifndef sqrtf #define sqrtf(a) ((float)sqrt(a)) @@ -138,7 +138,7 @@ static const int NAN_INT = 0x7FC00000; #define copysignf(a, b) ((float)copysign(a, b)) #endif -#endif /* C99 or POSIX.1-2001 */ +#endif /* C99, POSIX.1-2001 or MSVC12 (partial C99) */ #ifdef WIN32 # if defined(_MSC_VER) diff --git a/source/blender/blenlib/BLI_math_color_blend.h b/source/blender/blenlib/BLI_math_color_blend.h index 2535a31ccc4..d966676e19e 100644 --- a/source/blender/blenlib/BLI_math_color_blend.h +++ b/source/blender/blenlib/BLI_math_color_blend.h @@ -78,22 +78,22 @@ MINLINE void blend_color_darken_float(float dst[4], const float src1[4], const f MINLINE void blend_color_erase_alpha_float(float dst[4], const float src1[4], const float src2[4]); MINLINE void blend_color_add_alpha_float(float dst[4], const float src1[4], const float src2[4]); -MINLINE void blend_color_overlay_float(float dst[4], const float src1[4], const float src2[2]); -MINLINE void blend_color_hardlight_float(float dst[4], const float src1[4], const float src2[2]); -MINLINE void blend_color_burn_float(float dst[4], const float src1[4], const float src2[2]); -MINLINE void blend_color_linearburn_float(float dst[4], const float src1[4], const float src2[2]); -MINLINE void blend_color_dodge_float(float dst[4], const float src1[4], const float src2[2]); -MINLINE void blend_color_screen_float(float dst[4], const float src1[4], const float src2[2]); -MINLINE void blend_color_softlight_float(float dst[4], const float src1[4], const float src2[2]); -MINLINE void blend_color_pinlight_float(float dst[4], const float src1[4], const float src2[2]); -MINLINE void blend_color_linearlight_float(float dst[4], const float src1[4], const float src2[2]); -MINLINE void blend_color_vividlight_float(float dst[4], const float src1[4], const float src2[2]); -MINLINE void blend_color_difference_float(float dst[4], const float src1[4], const float src2[2]); -MINLINE void blend_color_exclusion_float(float dst[4], const float src1[4], const float src2[2]); -MINLINE void blend_color_color_float(float dst[4], const float src1[4], const float src2[2]); -MINLINE void blend_color_hue_float(float dst[4], const float src1[4], const float src2[2]); -MINLINE void blend_color_saturation_float(float dst[4], const float src1[4], const float src2[2]); -MINLINE void blend_color_luminosity_float(float dst[4], const float src1[4], const float src2[2]); +MINLINE void blend_color_overlay_float(float dst[4], const float src1[4], const float src2[4]); +MINLINE void blend_color_hardlight_float(float dst[4], const float src1[4], const float src2[4]); +MINLINE void blend_color_burn_float(float dst[4], const float src1[4], const float src2[4]); +MINLINE void blend_color_linearburn_float(float dst[4], const float src1[4], const float src2[4]); +MINLINE void blend_color_dodge_float(float dst[4], const float src1[4], const float src2[4]); +MINLINE void blend_color_screen_float(float dst[4], const float src1[4], const float src2[4]); +MINLINE void blend_color_softlight_float(float dst[4], const float src1[4], const float src2[4]); +MINLINE void blend_color_pinlight_float(float dst[4], const float src1[4], const float src2[4]); +MINLINE void blend_color_linearlight_float(float dst[4], const float src1[4], const float src2[4]); +MINLINE void blend_color_vividlight_float(float dst[4], const float src1[4], const float src2[4]); +MINLINE void blend_color_difference_float(float dst[4], const float src1[4], const float src2[4]); +MINLINE void blend_color_exclusion_float(float dst[4], const float src1[4], const float src2[4]); +MINLINE void blend_color_color_float(float dst[4], const float src1[4], const float src2[4]); +MINLINE void blend_color_hue_float(float dst[4], const float src1[4], const float src2[4]); +MINLINE void blend_color_saturation_float(float dst[4], const float src1[4], const float src2[4]); +MINLINE void blend_color_luminosity_float(float dst[4], const float src1[4], const float src2[4]); MINLINE void blend_color_interpolate_float(float dst[4], const float src1[4], const float src2[4], float t); diff --git a/source/blender/blenlib/BLI_stack.h b/source/blender/blenlib/BLI_stack.h index 1e0b29bc7e8..a8c4478c450 100644 --- a/source/blender/blenlib/BLI_stack.h +++ b/source/blender/blenlib/BLI_stack.h @@ -46,6 +46,9 @@ void BLI_stack_push(BLI_Stack *stack, const void *src) ATTR_NONNULL(); void BLI_stack_pop_n(BLI_Stack *stack, void *dst, unsigned int n) ATTR_NONNULL(); void BLI_stack_pop(BLI_Stack *stack, void *dst) ATTR_NONNULL(); +void *BLI_stack_peek(BLI_Stack *stack) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); +void BLI_stack_discard(BLI_Stack *stack) ATTR_NONNULL(); + size_t BLI_stack_count(const BLI_Stack *stack) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); bool BLI_stack_is_empty(const BLI_Stack *stack) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); diff --git a/source/blender/blenlib/BLI_stackdefines.h b/source/blender/blenlib/BLI_stackdefines.h index da9bf5ea04c..864a7704aa9 100644 --- a/source/blender/blenlib/BLI_stackdefines.h +++ b/source/blender/blenlib/BLI_stackdefines.h @@ -64,6 +64,13 @@ stack[_i] = stack[_##stack##_index]; \ } \ } (void)0 +#define STACK_DISCARD(stack, n) \ + { \ + const unsigned int _n = n; \ + BLI_assert(_##stack##_index >= _n); \ + (void)stack; \ + _##stack##_index -= _n; \ + } (void)0 #ifdef __GNUC__ #define STACK_SWAP(stack_a, stack_b) { \ SWAP(typeof(stack_a), stack_a, stack_b); \ diff --git a/source/blender/blenlib/BLI_strict_flags.h b/source/blender/blenlib/BLI_strict_flags.h index 1d595ff3bf3..964ee06469d 100644 --- a/source/blender/blenlib/BLI_strict_flags.h +++ b/source/blender/blenlib/BLI_strict_flags.h @@ -28,13 +28,15 @@ */ #ifdef __GNUC__ -# pragma GCC diagnostic error "-Wsign-conversion" # if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 /* gcc4.6+ only */ # pragma GCC diagnostic error "-Wsign-compare" # pragma GCC diagnostic error "-Wconversion" # endif -# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 /* gcc4.8+ only (behavior changed to ignore globals)*/ +# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 + /* gcc4.8+ only (behavior changed to ignore globals)*/ # pragma GCC diagnostic error "-Wshadow" + /* older gcc changed behavior with ternary */ +# pragma GCC diagnostic error "-Wsign-conversion" # endif /* pedantic gives too many issues, developers can define this for own use */ # ifdef WARN_PEDANTIC diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index 683b3c4c438..a829cc60106 100644 --- a/source/blender/blenlib/BLI_utildefines.h +++ b/source/blender/blenlib/BLI_utildefines.h @@ -47,11 +47,15 @@ #define _VA_NARGS_RETURN_COUNT(\ _1_, _2_, _3_, _4_, _5_, _6_, _7_, _8_, _9_, _10_, _11_, _12_, _13_, _14_, _15_, _16_, \ _17_, _18_, _19_, _20_, _21_, _22_, _23_, _24_, _25_, _26_, _27_, _28_, _29_, _30_, _31_, _32_, \ + _33_, _34_, _35_, _36_, _37_, _38_, _39_, _40_, _41_, _42_, _43_, _44_, _45_, _46_, _47_, _48_, \ + _49_, _50_, _51_, _52_, _53_, _54_, _55_, _56_, _57_, _58_, _59_, _60_, _61_, _62_, _63_, _64_, \ count, ...) count #define _VA_NARGS_EXPAND(args) _VA_NARGS_RETURN_COUNT args #define _VA_NARGS_COUNT_MAX32(...) _VA_NARGS_EXPAND((__VA_ARGS__, \ - 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, \ - 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)) + 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, \ + 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, \ + 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, \ + 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)) #define _VA_NARGS_OVERLOAD_MACRO2(name, count) name##count #define _VA_NARGS_OVERLOAD_MACRO1(name, count) _VA_NARGS_OVERLOAD_MACRO2(name, count) #define _VA_NARGS_OVERLOAD_MACRO(name, count) _VA_NARGS_OVERLOAD_MACRO1(name, count) @@ -67,6 +71,9 @@ # define MAX2(x, y) (_TYPECHECK(x, y), (((x) > (y) ? (x) : (y)))) #endif +/* include after _VA_NARGS macro */ +#include "BLI_compiler_typecheck.h" + /* min/max */ #if defined(__GNUC__) || defined(__clang__) @@ -151,48 +158,6 @@ /* some math and copy defines */ -/* Causes warning: - * incompatible types when assigning to type 'Foo' from type 'Bar' - * ... the compiler optimizes away the temp var */ -#ifdef __GNUC__ -#define CHECK_TYPE(var, type) { \ - typeof(var) *__tmp; \ - __tmp = (type *)NULL; \ - (void)__tmp; \ -} (void)0 - -#define CHECK_TYPE_PAIR(var_a, var_b) { \ - typeof(var_a) *__tmp; \ - __tmp = (typeof(var_b) *)NULL; \ - (void)__tmp; \ -} (void)0 - -#define CHECK_TYPE_PAIR_INLINE(var_a, var_b) ((void)({ \ - typeof(var_a) *__tmp; \ - __tmp = (typeof(var_b) *)NULL; \ - (void)__tmp; \ -})) - -#else -# define CHECK_TYPE(var, type) -# define CHECK_TYPE_PAIR(var_a, var_b) -# define CHECK_TYPE_PAIR_INLINE(var_a, var_b) (void)0 -#endif - -/* can be used in simple macros */ -#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) -# define CHECK_TYPE_INLINE(val, type) \ - (void)((void)(((type)0) != (0 ? (val) : ((type)0))), \ - _Generic((val), type: 0, const type: 0)) -#else -# define CHECK_TYPE_INLINE(val, type) \ - ((void)(((type)0) != (0 ? (val) : ((type)0)))) -#endif - -#define CHECK_TYPE_NONCONST(var) { \ - void *non_const = 0 ? (var) : NULL; \ - (void)non_const; \ -} (void)0 #define SWAP(type, a, b) { \ type sw_ap; \ diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index dd02bcf22a9..9efa20da13e 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -118,6 +118,7 @@ set(SRC BLI_callbacks.h BLI_compiler_attrs.h BLI_compiler_compat.h + BLI_compiler_typecheck.h BLI_convexhull2d.h BLI_dial.h BLI_dlrbTree.h diff --git a/source/blender/blenlib/intern/BLI_args.c b/source/blender/blenlib/intern/BLI_args.c index 8bd35f651b7..49a3c466727 100644 --- a/source/blender/blenlib/intern/BLI_args.c +++ b/source/blender/blenlib/intern/BLI_args.c @@ -91,15 +91,17 @@ static unsigned int keyhash(const void *ptr) return case_strhash(k->arg); /* ^ BLI_ghashutil_inthash((void *)k->pass); */ } -static int keycmp(const void *a, const void *b) +static bool keycmp(const void *a, const void *b) { const bAKey *ka = a; const bAKey *kb = b; if (ka->pass == kb->pass || ka->pass == -1 || kb->pass == -1) { /* -1 is wildcard for pass */ - if (ka->case_str == 1 || kb->case_str == 1) - return BLI_strcasecmp(ka->arg, kb->arg); - else - return strcmp(ka->arg, kb->arg); + if (ka->case_str == 1 || kb->case_str == 1) { + return (BLI_strcasecmp(ka->arg, kb->arg) != 0); + } + else { + return (strcmp(ka->arg, kb->arg) != 0); + } } else { return BLI_ghashutil_intcmp((const void *)ka->pass, (const void *)kb->pass); diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c index 74d7fdc88cb..6747e5c4e7e 100644 --- a/source/blender/blenlib/intern/BLI_ghash.c +++ b/source/blender/blenlib/intern/BLI_ghash.c @@ -155,7 +155,7 @@ BLI_INLINE Entry *ghash_lookup_entry_ex(GHash *gh, const void *key, Entry *e; for (e = gh->buckets[hash]; e; e = e->next) { - if (UNLIKELY(gh->cmpfp(key, e->key) == 0)) { + if (UNLIKELY(gh->cmpfp(key, e->key) == false)) { return e; } } @@ -251,7 +251,7 @@ static Entry *ghash_remove_ex(GHash *gh, void *key, GHashKeyFreeFP keyfreefp, GH Entry *e_prev = NULL; for (e = gh->buckets[hash]; e; e = e->next) { - if (UNLIKELY(gh->cmpfp(key, e->key) == 0)) { + if (UNLIKELY(gh->cmpfp(key, e->key) == false)) { Entry *e_next = e->next; if (keyfreefp) keyfreefp(e->key); @@ -683,12 +683,9 @@ unsigned int BLI_ghashutil_ptrhash(const void *key) return (unsigned int)y; } #endif -int BLI_ghashutil_ptrcmp(const void *a, const void *b) +bool BLI_ghashutil_ptrcmp(const void *a, const void *b) { - if (a == b) - return 0; - else - return (a < b) ? -1 : 1; + return (a != b); } unsigned int BLI_ghashutil_uinthash_v4(const unsigned int key[4]) @@ -704,9 +701,9 @@ unsigned int BLI_ghashutil_uinthash_v4(const unsigned int key[4]) return hash; } -int BLI_ghashutil_uinthash_v4_cmp(const void *a, const void *b) +bool BLI_ghashutil_uinthash_v4_cmp(const void *a, const void *b) { - return memcmp(a, b, sizeof(unsigned int[4])); + return (memcmp(a, b, sizeof(unsigned int[4])) != 0); } unsigned int BLI_ghashutil_uinthash(unsigned int key) @@ -735,12 +732,9 @@ unsigned int BLI_ghashutil_inthash_p(const void *ptr) return (unsigned int)(key & 0xffffffff); } -int BLI_ghashutil_intcmp(const void *a, const void *b) +bool BLI_ghashutil_intcmp(const void *a, const void *b) { - if (a == b) - return 0; - else - return (a < b) ? -1 : 1; + return (a != b); } /** @@ -774,9 +768,9 @@ unsigned int BLI_ghashutil_strhash_p(const void *ptr) return h; } -int BLI_ghashutil_strcmp(const void *a, const void *b) +bool BLI_ghashutil_strcmp(const void *a, const void *b) { - return strcmp(a, b); + return (strcmp(a, b) != 0); } GHashPair *BLI_ghashutil_pairalloc(const void *first, const void *second) @@ -794,15 +788,13 @@ unsigned int BLI_ghashutil_pairhash(const void *ptr) return hash ^ BLI_ghashutil_ptrhash(pair->second); } -int BLI_ghashutil_paircmp(const void *a, const void *b) +bool BLI_ghashutil_paircmp(const void *a, const void *b) { const GHashPair *A = a; const GHashPair *B = b; - int cmp = BLI_ghashutil_ptrcmp(A->first, B->first); - if (cmp == 0) - return BLI_ghashutil_ptrcmp(A->second, B->second); - return cmp; + return (BLI_ghashutil_ptrcmp(A->first, B->first) || + BLI_ghashutil_ptrcmp(A->second, B->second)); } void BLI_ghashutil_pairfree(void *ptr) diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c index dbacb0f3451..d28215ee8ed 100644 --- a/source/blender/blenlib/intern/BLI_kdopbvh.c +++ b/source/blender/blenlib/intern/BLI_kdopbvh.c @@ -979,7 +979,7 @@ void BLI_bvhtree_insert(BVHTree *tree, int index, const float co[3], int numpoin /* call before BLI_bvhtree_update_tree() */ -int BLI_bvhtree_update_node(BVHTree *tree, int index, const float co[3], const float co_moving[3], int numpoints) +bool BLI_bvhtree_update_node(BVHTree *tree, int index, const float co[3], const float co_moving[3], int numpoints) { BVHNode *node = NULL; axis_t axis_iter; diff --git a/source/blender/blenlib/intern/buffer.c b/source/blender/blenlib/intern/buffer.c index 4e570823319..9e96205a5e8 100644 --- a/source/blender/blenlib/intern/buffer.c +++ b/source/blender/blenlib/intern/buffer.c @@ -38,17 +38,14 @@ static void *buffer_alloc(BLI_Buffer *buffer, int len) static void *buffer_realloc(BLI_Buffer *buffer, int len) { - if (buffer->flag & BLI_BUFFER_USE_CALLOC) { - return MEM_recallocN(buffer->data, buffer->elem_size * len); - } - else { - return MEM_reallocN(buffer->data, buffer->elem_size * len); - } + return ((buffer->flag & BLI_BUFFER_USE_CALLOC) ? + MEM_recallocN_id : MEM_reallocN_id) + (buffer->data, buffer->elem_size * len, "BLI_Buffer.data"); } void BLI_buffer_resize(BLI_Buffer *buffer, int new_count) { - if (new_count > buffer->alloc_count) { + if (UNLIKELY(new_count > buffer->alloc_count)) { if (buffer->flag & BLI_BUFFER_USE_STATIC) { void *orig = buffer->data; @@ -65,12 +62,7 @@ void BLI_buffer_resize(BLI_Buffer *buffer, int new_count) buffer->alloc_count = new_count; } - if (buffer->data) { - buffer->data = buffer_realloc(buffer, buffer->alloc_count); - } - else { - buffer->data = buffer_alloc(buffer, buffer->alloc_count); - } + buffer->data = buffer_realloc(buffer, buffer->alloc_count); } } diff --git a/source/blender/blenlib/intern/listbase.c b/source/blender/blenlib/intern/listbase.c index abf15d57cf7..d9cf8971246 100644 --- a/source/blender/blenlib/intern/listbase.c +++ b/source/blender/blenlib/intern/listbase.c @@ -173,7 +173,7 @@ void BLI_freelinkN(ListBase *listbase, void *vlink) * (which should return 1 iff its first arg should come after its second arg). * This uses insertion sort, so NOT ok for large list. */ -void BLI_sortlist(ListBase *listbase, int (*cmp)(void *, void *)) +void BLI_sortlist(ListBase *listbase, int (*cmp)(const void *, const void *)) { Link *current = NULL; Link *previous = NULL; @@ -195,7 +195,7 @@ void BLI_sortlist(ListBase *listbase, int (*cmp)(void *, void *)) } } -void BLI_sortlist_r(ListBase *listbase, void *thunk, int (*cmp)(void *, void *, void *)) +void BLI_sortlist_r(ListBase *listbase, void *thunk, int (*cmp)(void *, const void *, const void *)) { Link *current = NULL; Link *previous = NULL; diff --git a/source/blender/blenlib/intern/math_color_blend_inline.c b/source/blender/blenlib/intern/math_color_blend_inline.c index 2522fe5f6c9..73a7259ddcd 100644 --- a/source/blender/blenlib/intern/math_color_blend_inline.c +++ b/source/blender/blenlib/intern/math_color_blend_inline.c @@ -781,7 +781,7 @@ MINLINE void blend_color_add_alpha_float(float dst[4], const float src1[4], cons } } -MINLINE void blend_color_overlay_float(float dst[3], const float src1[3], const float src2[3]) +MINLINE void blend_color_overlay_float(float dst[4], const float src1[4], const float src2[4]) { const float fac = src2[3]; if (fac != 0.0f && fac < 1.0f) { @@ -807,7 +807,7 @@ MINLINE void blend_color_overlay_float(float dst[3], const float src1[3], const } -MINLINE void blend_color_hardlight_float(float dst[4], const float src1[4], const float src2[2]) +MINLINE void blend_color_hardlight_float(float dst[4], const float src1[4], const float src2[4]) { const float fac = src2[3]; if (fac != 0.0f && fac < 1.0f) { @@ -832,7 +832,7 @@ MINLINE void blend_color_hardlight_float(float dst[4], const float src1[4], cons } } -MINLINE void blend_color_burn_float(float dst[3], const float src1[3], const float src2[3]) +MINLINE void blend_color_burn_float(float dst[4], const float src1[4], const float src2[4]) { const float fac = src2[3]; if (fac != 0.0f && fac < 1.0f) { @@ -850,7 +850,7 @@ MINLINE void blend_color_burn_float(float dst[3], const float src1[3], const flo } } -MINLINE void blend_color_linearburn_float(float dst[3], const float src1[3], const float src2[3]) +MINLINE void blend_color_linearburn_float(float dst[4], const float src1[4], const float src2[4]) { const float fac = src2[3]; if (fac != 0.0f && fac < 1.0f) { @@ -869,7 +869,7 @@ MINLINE void blend_color_linearburn_float(float dst[3], const float src1[3], con } -MINLINE void blend_color_dodge_float(float dst[3], const float src1[3], const float src2[3]) +MINLINE void blend_color_dodge_float(float dst[4], const float src1[4], const float src2[4]) { const float fac = src2[3]; if (fac != 0.0f && fac < 1.0f) { @@ -887,7 +887,7 @@ MINLINE void blend_color_dodge_float(float dst[3], const float src1[3], const fl } } -MINLINE void blend_color_screen_float(float dst[3], const float src1[3], const float src2[3]) +MINLINE void blend_color_screen_float(float dst[4], const float src1[4], const float src2[4]) { const float fac = src2[3]; if (fac != 0.0f && fac < 1.0f) { @@ -905,7 +905,7 @@ MINLINE void blend_color_screen_float(float dst[3], const float src1[3], const f } } -MINLINE void blend_color_softlight_float(float dst[3], const float src1[3], const float src2[3]) +MINLINE void blend_color_softlight_float(float dst[4], const float src1[4], const float src2[4]) { const float fac = src2[3]; if (fac != 0.0f && fac < 1.0f) { @@ -930,7 +930,7 @@ MINLINE void blend_color_softlight_float(float dst[3], const float src1[3], cons } } -MINLINE void blend_color_pinlight_float(float dst[3], const float src1[3], const float src2[3]) +MINLINE void blend_color_pinlight_float(float dst[4], const float src1[4], const float src2[4]) { const float fac = src2[3]; if (fac != 0.0f && fac < 1.0f) { @@ -956,7 +956,7 @@ MINLINE void blend_color_pinlight_float(float dst[3], const float src1[3], const } -MINLINE void blend_color_linearlight_float(float dst[3], const float src1[3], const float src2[3]) +MINLINE void blend_color_linearlight_float(float dst[4], const float src1[4], const float src2[4]) { const float fac = src2[3]; if (fac != 0.0f && fac < 1.0f) { @@ -982,7 +982,7 @@ MINLINE void blend_color_linearlight_float(float dst[3], const float src1[3], co } -MINLINE void blend_color_vividlight_float(float dst[3], const float src1[3], const float src2[3]) +MINLINE void blend_color_vividlight_float(float dst[4], const float src1[4], const float src2[4]) { const float fac = src2[3]; if (fac != 0.0f && fac < 1.0f) { @@ -1013,7 +1013,7 @@ MINLINE void blend_color_vividlight_float(float dst[3], const float src1[3], con } } -MINLINE void blend_color_difference_float(float dst[3], const float src1[3], const float src2[3]) +MINLINE void blend_color_difference_float(float dst[4], const float src1[4], const float src2[4]) { const float fac = src2[3]; if (fac != 0.0f && fac < 1.0f) { @@ -1031,7 +1031,7 @@ MINLINE void blend_color_difference_float(float dst[3], const float src1[3], con } -MINLINE void blend_color_exclusion_float(float dst[3], const float src1[3], const float src2[3]) +MINLINE void blend_color_exclusion_float(float dst[4], const float src1[4], const float src2[4]) { const float fac = src2[3]; if (fac != 0.0f && fac < 1.0f) { @@ -1050,7 +1050,7 @@ MINLINE void blend_color_exclusion_float(float dst[3], const float src1[3], cons } -MINLINE void blend_color_color_float(float dst[3], const float src1[3], const float src2[3]) +MINLINE void blend_color_color_float(float dst[4], const float src1[4], const float src2[4]) { const float fac = src2[3]; if (fac != 0.0f && fac < 1.0f) { @@ -1078,7 +1078,7 @@ MINLINE void blend_color_color_float(float dst[3], const float src1[3], const fl } -MINLINE void blend_color_hue_float(float dst[3], const float src1[3], const float src2[3]) +MINLINE void blend_color_hue_float(float dst[4], const float src1[4], const float src2[4]) { const float fac = src2[3]; if (fac != 0.0f && fac < 1.0f) { @@ -1104,7 +1104,7 @@ MINLINE void blend_color_hue_float(float dst[3], const float src1[3], const floa } } -MINLINE void blend_color_saturation_float(float dst[3], const float src1[3], const float src2[3]) +MINLINE void blend_color_saturation_float(float dst[4], const float src1[4], const float src2[4]) { const float fac = src2[3]; if (fac != 0.0f && fac < 1.0f) { @@ -1131,7 +1131,7 @@ MINLINE void blend_color_saturation_float(float dst[3], const float src1[3], con } } -MINLINE void blend_color_luminosity_float(float dst[3], const float src1[3], const float src2[3]) +MINLINE void blend_color_luminosity_float(float dst[4], const float src1[4], const float src2[4]) { const float fac = src2[3]; if (fac != 0.0f && fac < 1.0f) { diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 17a1dcbf34d..496e5362cc4 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -160,6 +160,12 @@ float area_poly_v3(const float verts[][3], unsigned int nr) return normal_poly_v3(n, verts, nr) * 0.5f; } +/** + * Scalar cross product of a 2d polygon. + * + * - equivalent to ``area * 2`` + * - useful for checking polygon winding (a positive value is clockwise). + */ float cross_poly_v2(const float verts[][2], unsigned int nr) { unsigned int a; @@ -1786,7 +1792,10 @@ float closest_to_line_v2(float cp[2], const float p[2], const float l1[2], const return lambda; } -/* little sister we only need to know lambda */ +/** + * A simplified version of #closest_to_line_v3 + * we only need to return the ``lambda`` + */ float line_point_factor_v3(const float p[3], const float l1[3], const float l2[3]) { float h[3], u[3]; @@ -3193,7 +3202,7 @@ void map_to_tube(float *r_u, float *r_v, const float x, const float y, const flo len = sqrtf(x * x + y * y); if (len > 0.0f) { - *r_u = (float)((1.0 - (atan2(x / len, y / len) / M_PI)) / 2.0); + *r_u = (1.0f - (atan2f(x / len, y / len) / (float)M_PI)) / 2.0f; } else { *r_v = *r_u = 0.0f; /* to avoid un-initialized variables */ diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index 141f9201689..9a6515daf68 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -366,7 +366,7 @@ void mat3_to_quat_is_ok(float q[4], float wmat[3][3]) mul_m3_v3(matn, mat[0]); /* and align x-axes */ - angle = (float)(0.5 * atan2(mat[0][1], mat[0][0])); + angle = 0.5f * atan2f(mat[0][1], mat[0][0]); co = cosf(angle); si = sinf(angle); @@ -765,7 +765,7 @@ void tri_to_quat_ex(float quat[4], const float v1[3], const float v2[3], const f vec[2] = 0.0f; normalize_v3(vec); - angle = (float)(0.5 * atan2(vec[1], vec[0])); + angle = 0.5f * atan2f(vec[1], vec[0]); co = cosf(angle); si = sinf(angle); q2[0] = co; diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c index 5529433f6c9..da9d5bd3f49 100644 --- a/source/blender/blenlib/intern/math_vector_inline.c +++ b/source/blender/blenlib/intern/math_vector_inline.c @@ -957,6 +957,18 @@ MINLINE bool compare_v4v4(const float v1[4], const float v2[4], const float limi return false; } +/** + * <pre> + * + l1 + * | + * neg <- | -> pos + * | + * + l2 + * </pre> + * + * \return Positive value when 'pt' is left-of-line + * (looking from 'l1' -> 'l2'). + */ MINLINE float line_point_side_v2(const float l1[2], const float l2[2], const float pt[2]) { return (((l1[0] - pt[0]) * (l2[1] - pt[1])) - diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index a7fa443cfc4..d5af980e373 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -873,9 +873,12 @@ bool BLI_path_abs(char *path, const char *basepath) char tmp[FILE_MAX]; char base[FILE_MAX]; #ifdef WIN32 - char vol[3] = {'\0', '\0', '\0'}; - BLI_strncpy(vol, path, 3); + /* without this: "" --> "C:\" */ + if (*path == '\0') { + return wasrelative; + } + /* we are checking here if we have an absolute path that is not in the current * blend file as a lib main - we are basically checking for the case that a * UNIX root '/' is passed. diff --git a/source/blender/blenlib/intern/polyfill2d.c b/source/blender/blenlib/intern/polyfill2d.c index a00d95a075f..16cf7ff960b 100644 --- a/source/blender/blenlib/intern/polyfill2d.c +++ b/source/blender/blenlib/intern/polyfill2d.c @@ -567,7 +567,7 @@ static void pf_triangulate(PolyFill *pf) #ifdef USE_CLIP_EVEN #ifdef USE_CLIP_SWEEP - pi_ear_init = reverse ? pi_next->next : pi_prev->prev; + pi_ear_init = reverse ? pi_prev->prev : pi_next->next; #else pi_ear_init = pi_next->next; #endif diff --git a/source/blender/blenlib/intern/scanfill_utils.c b/source/blender/blenlib/intern/scanfill_utils.c index 828cb3a580b..9fc1db1f1e4 100644 --- a/source/blender/blenlib/intern/scanfill_utils.c +++ b/source/blender/blenlib/intern/scanfill_utils.c @@ -132,12 +132,12 @@ static ListBase *edge_isect_ls_add(GHash *isect_hash, ScanFillEdge *eed, ScanFil return e_ls; } -static int edge_isect_ls_sort_cb(void *thunk, void *def_a_ptr, void *def_b_ptr) +static int edge_isect_ls_sort_cb(void *thunk, const void *def_a_ptr, const void *def_b_ptr) { const float *co = thunk; - ScanFillIsect *i_a = (ScanFillIsect *)(((LinkData *)def_a_ptr)->data); - ScanFillIsect *i_b = (ScanFillIsect *)(((LinkData *)def_b_ptr)->data); + const ScanFillIsect *i_a = ((LinkData *)def_a_ptr)->data; + const ScanFillIsect *i_b = ((LinkData *)def_b_ptr)->data; const float a = len_squared_v2v2(co, i_a->co); const float b = len_squared_v2v2(co, i_b->co); diff --git a/source/blender/blenlib/intern/stack.c b/source/blender/blenlib/intern/stack.c index 58029120de9..2d3a2f77a3e 100644 --- a/source/blender/blenlib/intern/stack.c +++ b/source/blender/blenlib/intern/stack.c @@ -48,8 +48,6 @@ ((void)0, (((char *)(_stack)->chunk_curr->data) + \ ((_stack)->elem_size * (_stack)->chunk_index))) -#define IS_POW2(a) (((a) & ((a) - 1)) == 0) - struct StackChunk { struct StackChunk *next; char data[0]; @@ -96,11 +94,6 @@ BLI_Stack *BLI_stack_new_ex(const size_t elem_size, const char *description, /* force init */ stack->chunk_index = stack->chunk_elem_max - 1; - /* ensure we have a correctly rounded size */ - BLI_assert((IS_POW2(stack->elem_size) == 0) || - (IS_POW2((stack->chunk_elem_max * stack->elem_size) + - (sizeof(struct StackChunk) + MEM_SIZE_OVERHEAD)))); - return stack; } @@ -182,6 +175,31 @@ void BLI_stack_pop(BLI_Stack *stack, void *dst) BLI_assert(BLI_stack_is_empty(stack) == false); memcpy(dst, CHUNK_LAST_ELEM(stack), stack->elem_size); + + BLI_stack_discard(stack); +} + +void BLI_stack_pop_n(BLI_Stack *stack, void *dst, unsigned int n) +{ + BLI_assert(n <= BLI_stack_count(stack)); + + while (n--) { + BLI_stack_pop(stack, dst); + dst = (void *)((char *)dst + stack->elem_size); + } +} + +void *BLI_stack_peek(BLI_Stack *stack) +{ + BLI_assert(BLI_stack_is_empty(stack) == false); + + return CHUNK_LAST_ELEM(stack); +} + +void BLI_stack_discard(BLI_Stack *stack) +{ + BLI_assert(BLI_stack_is_empty(stack) == false); + #ifdef USE_TOTELEM stack->totelem--; #endif @@ -198,16 +216,6 @@ void BLI_stack_pop(BLI_Stack *stack, void *dst) } } -void BLI_stack_pop_n(BLI_Stack *stack, void *dst, unsigned int n) -{ - BLI_assert(n <= BLI_stack_count(stack)); - - while (n--) { - BLI_stack_pop(stack, dst); - dst = (void *)((char *)dst + stack->elem_size); - } -} - size_t BLI_stack_count(const BLI_Stack *stack) { #ifdef USE_TOTELEM diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 8561903ce04..aea35963269 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -1862,6 +1862,7 @@ static void direct_link_palette(FileData *fd, Palette *palette) { /* palette itself has been read */ link_list(fd, &palette->colors); + BLI_listbase_clear(&palette->deleted); } static void lib_link_paint_curve(FileData *UNUSED(fd), Main *main) @@ -6237,7 +6238,6 @@ static void direct_link_region(FileData *fd, ARegion *ar, int spacetype) rv3d->depths = NULL; rv3d->gpuoffscreen = NULL; - rv3d->ri = NULL; rv3d->render_engine = NULL; rv3d->sms = NULL; rv3d->smooth_timer = NULL; @@ -8995,10 +8995,10 @@ static ID *append_named_part_ex(const bContext *C, Main *mainl, FileData *fd, co ob = (Object *)id; - /* link at active layer (view3d->lay if in context, else scene->lay */ + /* link at active layer (view3d if available in context, else scene one */ if ((flag & FILE_ACTIVELAY)) { View3D *v3d = CTX_wm_view3d(C); - ob->lay = v3d ? v3d->layact : scene->lay; + ob->lay = BKE_screen_view3d_layer_active(v3d, scene); } ob->mode = OB_MODE_OBJECT; diff --git a/source/blender/blenloader/intern/versioning_250.c b/source/blender/blenloader/intern/versioning_250.c index 06d871c8db0..40b756a3f7c 100644 --- a/source/blender/blenloader/intern/versioning_250.c +++ b/source/blender/blenloader/intern/versioning_250.c @@ -89,9 +89,6 @@ #include "NOD_socket.h" -//XXX #include "BIF_butspace.h" // badlevel, for do_versions, patching event codes -//XXX #include "BIF_filelist.h" // badlevel too, where to move this? - elubie -//XXX #include "BIF_previewrender.h" // bedlelvel, for struct RenderInfo #include "BLO_readfile.h" #include "BLO_undofile.h" diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c index 8e760a9c9f6..d8da0a12b50 100644 --- a/source/blender/blenloader/intern/versioning_270.c +++ b/source/blender/blenloader/intern/versioning_270.c @@ -350,12 +350,19 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main) for (br = main->brush.first; br; br = br->id.next) { br->fill_threshold = 0.2f; } - } - if (!DNA_struct_elem_find(fd->filesdna, "RenderData", "int", "preview_start_resolution")) { - Scene *scene; - for (scene = main->scene.first; scene; scene = scene->id.next) { - scene->r.preview_start_resolution = 64; + if (!DNA_struct_elem_find(fd->filesdna, "BevelModifierData", "int", "mat")) { + Object *ob; + for (ob = main->object.first; ob; ob = ob->id.next) { + ModifierData *md; + + for (md = ob->modifiers.first; md; md = md->next) { + if (md->type == eModifierType_Bevel) { + BevelModifierData *bmd = (BevelModifierData *)md; + bmd->mat = -1; + } + } + } } } @@ -374,4 +381,28 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main) } } } + + if (!MAIN_VERSION_ATLEAST(main, 272, 0)) { + if (!DNA_struct_elem_find(fd->filesdna, "RenderData", "int", "preview_start_resolution")) { + Scene *scene; + for (scene = main->scene.first; scene; scene = scene->id.next) { + scene->r.preview_start_resolution = 64; + } + } + } + + if (!MAIN_VERSION_ATLEAST(main, 272, 1)) { + Brush *br; + for (br = main->brush.first; br; br = br->id.next) { + if ((br->ob_mode & OB_MODE_SCULPT) && ELEM(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK)) + br->alpha = 1.0f; + } + } + + if (!DNA_struct_elem_find(fd->filesdna, "Image", "float", "gen_color")) { + Image *image; + for (image = main->image.first; image != NULL; image = image->id.next) { + image->gen_color[3] = 1.0f; + } + } } diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c index 217d1f0821f..1afcac313a2 100644 --- a/source/blender/blenloader/intern/versioning_defaults.c +++ b/source/blender/blenloader/intern/versioning_defaults.c @@ -99,6 +99,7 @@ void BLO_update_defaults_startup_blend(Main *bmain) linestyle->sort_key = LS_SORT_KEY_DISTANCE_FROM_CAMERA; linestyle->integration_type = LS_INTEGRATION_MEAN; linestyle->texstep = 1.0; + linestyle->chain_count = 10; } { diff --git a/source/blender/bmesh/CMakeLists.txt b/source/blender/bmesh/CMakeLists.txt index a43e835f022..50d3ac30ddc 100644 --- a/source/blender/bmesh/CMakeLists.txt +++ b/source/blender/bmesh/CMakeLists.txt @@ -140,6 +140,8 @@ set(SRC tools/bmesh_intersect.h tools/bmesh_path.c tools/bmesh_path.h + tools/bmesh_region_match.c + tools/bmesh_region_match.h tools/bmesh_triangulate.c tools/bmesh_triangulate.h tools/bmesh_wireframe.c diff --git a/source/blender/bmesh/bmesh.h b/source/blender/bmesh/bmesh.h index 8b5250b7c1e..4efc6aa16f8 100644 --- a/source/blender/bmesh/bmesh.h +++ b/source/blender/bmesh/bmesh.h @@ -58,8 +58,8 @@ * * \subsection bm_loop The Loop * - * Loops define the boundary loop of a face. Each loop logically corresponds to an edge, - * which is defined by the loop and next loop's vertices. + * Each loop connects the face to one of its corner vertices, + * and also references an edge which connects this loop's vertex to the next loop's vertex. * * Loops store several handy pointers: * diff --git a/source/blender/bmesh/bmesh_tools.h b/source/blender/bmesh/bmesh_tools.h index baffeb774b6..f7f767f91bf 100644 --- a/source/blender/bmesh/bmesh_tools.h +++ b/source/blender/bmesh/bmesh_tools.h @@ -41,6 +41,7 @@ extern "C" { #include "tools/bmesh_edgenet.h" #include "tools/bmesh_edgesplit.h" #include "tools/bmesh_path.h" +#include "tools/bmesh_region_match.h" #include "tools/bmesh_triangulate.h" #ifdef __cplusplus diff --git a/source/blender/bmesh/intern/bmesh_construct.c b/source/blender/bmesh/intern/bmesh_construct.c index eef1e7bbb4f..e0348fea636 100644 --- a/source/blender/bmesh/intern/bmesh_construct.c +++ b/source/blender/bmesh/intern/bmesh_construct.c @@ -505,7 +505,7 @@ static void bm_vert_attrs_copy(BMesh *source_mesh, BMesh *target_mesh, return; } copy_v3_v3(target_vertex->no, source_vertex->no); - CustomData_bmesh_free_block_data(&target_mesh->vdata, &target_vertex->head.data); + CustomData_bmesh_free_block_data(&target_mesh->vdata, target_vertex->head.data); CustomData_bmesh_copy_data(&source_mesh->vdata, &target_mesh->vdata, source_vertex->head.data, &target_vertex->head.data); } @@ -517,7 +517,7 @@ static void bm_edge_attrs_copy(BMesh *source_mesh, BMesh *target_mesh, BLI_assert(!"BMEdge: source and targer match"); return; } - CustomData_bmesh_free_block_data(&target_mesh->edata, &target_edge->head.data); + CustomData_bmesh_free_block_data(&target_mesh->edata, target_edge->head.data); CustomData_bmesh_copy_data(&source_mesh->edata, &target_mesh->edata, source_edge->head.data, &target_edge->head.data); } @@ -529,7 +529,7 @@ static void bm_loop_attrs_copy(BMesh *source_mesh, BMesh *target_mesh, BLI_assert(!"BMLoop: source and targer match"); return; } - CustomData_bmesh_free_block_data(&target_mesh->ldata, &target_loop->head.data); + CustomData_bmesh_free_block_data(&target_mesh->ldata, target_loop->head.data); CustomData_bmesh_copy_data(&source_mesh->ldata, &target_mesh->ldata, source_loop->head.data, &target_loop->head.data); } @@ -542,7 +542,7 @@ static void bm_face_attrs_copy(BMesh *source_mesh, BMesh *target_mesh, return; } copy_v3_v3(target_face->no, source_face->no); - CustomData_bmesh_free_block_data(&target_mesh->pdata, &target_face->head.data); + CustomData_bmesh_free_block_data(&target_mesh->pdata, target_face->head.data); CustomData_bmesh_copy_data(&source_mesh->pdata, &target_mesh->pdata, source_face->head.data, &target_face->head.data); target_face->mat_nr = source_face->mat_nr; diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c index 1f942dad048..eb7b9f78ef4 100644 --- a/source/blender/bmesh/intern/bmesh_core.c +++ b/source/blender/bmesh/intern/bmesh_core.c @@ -1473,8 +1473,10 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e) valence2 = bmesh_disk_count(tv); #endif + /* order of 'e_new' verts should match 'e' + * (so extruded faces don't flip) */ v_new = BM_vert_create(bm, tv->co, tv, BM_CREATE_NOP); - e_new = BM_edge_create(bm, v_new, tv, e, BM_CREATE_NOP); + e_new = BM_edge_create(bm, tv, v_new, e, BM_CREATE_NOP); bmesh_disk_edge_remove(e_new, tv); bmesh_disk_edge_remove(e_new, v_new); diff --git a/source/blender/bmesh/intern/bmesh_interp.c b/source/blender/bmesh/intern/bmesh_interp.c index 306b6e74350..a32f28169f6 100644 --- a/source/blender/bmesh/intern/bmesh_interp.c +++ b/source/blender/bmesh/intern/bmesh_interp.c @@ -54,7 +54,7 @@ static void bm_data_interp_from_elem(CustomData *data_layer, BMElem *ele1, BMEle /* do nothing */ } else { - CustomData_bmesh_free_block_data(data_layer, &ele_dst->head.data); + CustomData_bmesh_free_block_data(data_layer, ele_dst->head.data); CustomData_bmesh_copy_data(data_layer, data_layer, ele1->head.data, &ele_dst->head.data); } } @@ -63,7 +63,7 @@ static void bm_data_interp_from_elem(CustomData *data_layer, BMElem *ele1, BMEle /* do nothing */ } else { - CustomData_bmesh_free_block_data(data_layer, &ele_dst->head.data); + CustomData_bmesh_free_block_data(data_layer, ele_dst->head.data); CustomData_bmesh_copy_data(data_layer, data_layer, ele2->head.data, &ele_dst->head.data); } } diff --git a/source/blender/bmesh/intern/bmesh_iterators.c b/source/blender/bmesh/intern/bmesh_iterators.c index 91b9774634d..476878ad38c 100644 --- a/source/blender/bmesh/intern/bmesh_iterators.c +++ b/source/blender/bmesh/intern/bmesh_iterators.c @@ -338,50 +338,18 @@ int BM_iter_mesh_count_flag(const char itype, BMesh *bm, const char hflag, const # define USE_IMMUTABLE_ASSERT #endif -void bmiter__vert_of_mesh_begin(struct BMIter__vert_of_mesh *iter) +void bmiter__elem_of_mesh_begin(struct BMIter__elem_of_mesh *iter) { #ifdef USE_IMMUTABLE_ASSERT - ((BMIter *)iter)->count = iter->bm->totvert; + ((BMIter *)iter)->count = BLI_mempool_count(iter->pooliter.pool); #endif - BLI_mempool_iternew(iter->bm->vpool, &iter->pooliter); + BLI_mempool_iternew(iter->pooliter.pool, &iter->pooliter); } -void *bmiter__vert_of_mesh_step(struct BMIter__vert_of_mesh *iter) +void *bmiter__elem_of_mesh_step(struct BMIter__elem_of_mesh *iter) { #ifdef USE_IMMUTABLE_ASSERT - BLI_assert(((BMIter *)iter)->count <= iter->bm->totvert); -#endif - return BLI_mempool_iterstep(&iter->pooliter); -} - -void bmiter__edge_of_mesh_begin(struct BMIter__edge_of_mesh *iter) -{ -#ifdef USE_IMMUTABLE_ASSERT - ((BMIter *)iter)->count = iter->bm->totedge; -#endif - BLI_mempool_iternew(iter->bm->epool, &iter->pooliter); -} - -void *bmiter__edge_of_mesh_step(struct BMIter__edge_of_mesh *iter) -{ -#ifdef USE_IMMUTABLE_ASSERT - BLI_assert(((BMIter *)iter)->count <= iter->bm->totedge); -#endif - return BLI_mempool_iterstep(&iter->pooliter); -} - -void bmiter__face_of_mesh_begin(struct BMIter__face_of_mesh *iter) -{ -#ifdef USE_IMMUTABLE_ASSERT - ((BMIter *)iter)->count = iter->bm->totface; -#endif - BLI_mempool_iternew(iter->bm->fpool, &iter->pooliter); -} - -void *bmiter__face_of_mesh_step(struct BMIter__face_of_mesh *iter) -{ -#ifdef USE_IMMUTABLE_ASSERT - BLI_assert(((BMIter *)iter)->count <= iter->bm->totface); + BLI_assert(((BMIter *)iter)->count <= BLI_mempool_count(iter->pooliter.pool)); #endif return BLI_mempool_iterstep(&iter->pooliter); } diff --git a/source/blender/bmesh/intern/bmesh_iterators.h b/source/blender/bmesh/intern/bmesh_iterators.h index fdf0f27f05f..44be7072e71 100644 --- a/source/blender/bmesh/intern/bmesh_iterators.h +++ b/source/blender/bmesh/intern/bmesh_iterators.h @@ -110,16 +110,7 @@ extern const char bm_iter_itype_htype_map[BM_ITYPE_MAX]; for (ele = BM_iter_new(iter, NULL, itype, data), indexvar = 0; ele; ele = BM_iter_step(iter), (indexvar)++) /* iterator type structs */ -struct BMIter__vert_of_mesh { - BMesh *bm; - BLI_mempool_iter pooliter; -}; -struct BMIter__edge_of_mesh { - BMesh *bm; - BLI_mempool_iter pooliter; -}; -struct BMIter__face_of_mesh { - BMesh *bm; +struct BMIter__elem_of_mesh { BLI_mempool_iter pooliter; }; struct BMIter__edge_of_vert { @@ -173,9 +164,7 @@ typedef void *(*BMIter__step_cb) (void *); typedef struct BMIter { /* keep union first */ union { - struct BMIter__vert_of_mesh vert_of_mesh; - struct BMIter__edge_of_mesh edge_of_mesh; - struct BMIter__face_of_mesh face_of_mesh; + struct BMIter__elem_of_mesh elem_of_mesh; struct BMIter__edge_of_vert edge_of_vert; struct BMIter__face_of_vert face_of_vert; @@ -219,9 +208,7 @@ int BM_iter_mesh_count_flag(const char itype, BMesh *bm, const char hflag, c void bmiter__##name##_begin(struct BMIter__##name *iter); \ void *bmiter__##name##_step(struct BMIter__##name *iter) -BMITER_CB_DEF(vert_of_mesh); -BMITER_CB_DEF(edge_of_mesh); -BMITER_CB_DEF(face_of_mesh); +BMITER_CB_DEF(elem_of_mesh); BMITER_CB_DEF(edge_of_vert); BMITER_CB_DEF(face_of_vert); BMITER_CB_DEF(loop_of_vert); @@ -237,4 +224,12 @@ BMITER_CB_DEF(loop_of_face); #include "intern/bmesh_iterators_inline.h" +#define BM_ITER_CHECK_TYPE_DATA(data) \ + CHECK_TYPE_ANY(data, void *, BMFace *, BMEdge *, BMVert *, BMLoop *, BMElem *) + +#define BM_iter_new(iter, bm, itype, data) \ + (BM_ITER_CHECK_TYPE_DATA(data), BM_iter_new(iter, bm, itype, data)) +#define BM_iter_init(iter, bm, itype, data) \ + (BM_ITER_CHECK_TYPE_DATA(data), BM_iter_init(iter, bm, itype, data)) + #endif /* __BMESH_ITERATORS_H__ */ diff --git a/source/blender/bmesh/intern/bmesh_iterators_inline.h b/source/blender/bmesh/intern/bmesh_iterators_inline.h index b9733d4702f..d3e18b97acb 100644 --- a/source/blender/bmesh/intern/bmesh_iterators_inline.h +++ b/source/blender/bmesh/intern/bmesh_iterators_inline.h @@ -60,23 +60,23 @@ BLI_INLINE bool BM_iter_init(BMIter *iter, BMesh *bm, const char itype, void *da case BM_VERTS_OF_MESH: BLI_assert(bm != NULL); BLI_assert(data == NULL); - iter->begin = (BMIter__begin_cb)bmiter__vert_of_mesh_begin; - iter->step = (BMIter__step_cb)bmiter__vert_of_mesh_step; - iter->data.vert_of_mesh.bm = bm; + iter->begin = (BMIter__begin_cb)bmiter__elem_of_mesh_begin; + iter->step = (BMIter__step_cb)bmiter__elem_of_mesh_step; + iter->data.elem_of_mesh.pooliter.pool = bm->vpool; break; case BM_EDGES_OF_MESH: BLI_assert(bm != NULL); BLI_assert(data == NULL); - iter->begin = (BMIter__begin_cb)bmiter__edge_of_mesh_begin; - iter->step = (BMIter__step_cb)bmiter__edge_of_mesh_step; - iter->data.edge_of_mesh.bm = bm; + iter->begin = (BMIter__begin_cb)bmiter__elem_of_mesh_begin; + iter->step = (BMIter__step_cb)bmiter__elem_of_mesh_step; + iter->data.elem_of_mesh.pooliter.pool = bm->epool; break; case BM_FACES_OF_MESH: BLI_assert(bm != NULL); BLI_assert(data == NULL); - iter->begin = (BMIter__begin_cb)bmiter__face_of_mesh_begin; - iter->step = (BMIter__step_cb)bmiter__face_of_mesh_step; - iter->data.face_of_mesh.bm = bm; + iter->begin = (BMIter__begin_cb)bmiter__elem_of_mesh_begin; + iter->step = (BMIter__step_cb)bmiter__elem_of_mesh_step; + iter->data.elem_of_mesh.pooliter.pool = bm->fpool; break; case BM_EDGES_OF_VERT: BLI_assert(data != NULL); diff --git a/source/blender/bmesh/intern/bmesh_marking.c b/source/blender/bmesh/intern/bmesh_marking.c index 19e6f646564..ee35d8cd1d2 100644 --- a/source/blender/bmesh/intern/bmesh_marking.c +++ b/source/blender/bmesh/intern/bmesh_marking.c @@ -537,7 +537,7 @@ void BM_mesh_select_mode_set(BMesh *bm, int selectmode) * counts number of elements with flag enabled/disabled */ static int bm_mesh_flag_count(BMesh *bm, const char htype, const char hflag, - const short respecthide, const bool test_for_enabled) + const bool respecthide, const bool test_for_enabled) { BMElem *ele; BMIter iter; diff --git a/source/blender/bmesh/intern/bmesh_mods.c b/source/blender/bmesh/intern/bmesh_mods.c index 6e8591da0f3..72d25413f09 100644 --- a/source/blender/bmesh/intern/bmesh_mods.c +++ b/source/blender/bmesh/intern/bmesh_mods.c @@ -265,7 +265,8 @@ BMFace *BM_faces_join_pair(BMesh *bm, BMFace *f_a, BMFace *f_b, BMEdge *e, const * * \param bm The bmesh * \param f the original face - * \param v1, v2 vertices which define the split edge, must be different + * \param l_a, l_b Loops of this face, their vertices define + * the split edge to be created (must be differ and not can't be adjacent in the face). * \param r_l pointer which will receive the BMLoop for the split edge in the new face * \param example Edge used for attributes of splitting edge, if non-NULL * \param nodouble Use an existing edge if found @@ -348,7 +349,7 @@ BMFace *BM_face_split(BMesh *bm, BMFace *f, * \param l_a, l_b vertices which define the split edge, must be different * \param cos Array of coordinates for intermediate points * \param n Length of \a cos (must be > 0) - * \param r_l pointer which will receive the BMLoop for the first split edge (from \a v1) in the new face + * \param r_l pointer which will receive the BMLoop for the first split edge (from \a l_a) in the new face * \param example Edge used for attributes of splitting edge, if non-NULL * * \return Pointer to the newly created face representing one side of the split diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c index d8be55ce7c2..e2be90e7baf 100644 --- a/source/blender/bmesh/intern/bmesh_opdefines.c +++ b/source/blender/bmesh/intern/bmesh_opdefines.c @@ -104,6 +104,7 @@ static BMOpDefine bmo_smooth_vert_def = { "smooth_vert", /* slots_in */ {{"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */ + {"factor", BMO_OP_SLOT_FLT}, /* smoothing factor */ {"mirror_clip_x", BMO_OP_SLOT_BOOL}, /* set vertices close to the x axis before the operation to 0 */ {"mirror_clip_y", BMO_OP_SLOT_BOOL}, /* set vertices close to the y axis before the operation to 0 */ {"mirror_clip_z", BMO_OP_SLOT_BOOL}, /* set vertices close to the z axis before the operation to 0 */ diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c index 9a1914b5596..a8e1acd9c71 100644 --- a/source/blender/bmesh/intern/bmesh_polygon.c +++ b/source/blender/bmesh/intern/bmesh_polygon.c @@ -666,49 +666,25 @@ static bool line_crosses_v2f(const float v1[2], const float v2[2], const float v */ bool BM_face_point_inside_test(BMFace *f, const float co[3]) { - int ax, ay; - float co2[2], cent[2] = {0.0f, 0.0f}, out[2] = {FLT_MAX * 0.5f, FLT_MAX * 0.5f}; + float axis_mat[3][3]; + float (*projverts)[2] = BLI_array_alloca(projverts, f->len); + + float co_2d[2]; BMLoop *l_iter; - BMLoop *l_first; - int crosses = 0; - float onepluseps = 1.0f + (float)FLT_EPSILON * 150.0f; + int i; if (is_zero_v3(f->no)) BM_face_normal_update(f); - - /* find best projection of face XY, XZ or YZ: barycentric weights of - * the 2d projected coords are the same and faster to compute - * - * this probably isn't all that accurate, but it has the advantage of - * being fast (especially compared to projecting into the face orientation) - */ - axis_dominant_v3(&ax, &ay, f->no); - - co2[0] = co[ax]; - co2[1] = co[ay]; - - l_iter = l_first = BM_FACE_FIRST_LOOP(f); - do { - cent[0] += l_iter->v->co[ax]; - cent[1] += l_iter->v->co[ay]; - } while ((l_iter = l_iter->next) != l_first); - - mul_v2_fl(cent, 1.0f / (float)f->len); - - l_iter = l_first = BM_FACE_FIRST_LOOP(f); - do { - float v1[2], v2[2]; - - v1[0] = (l_iter->prev->v->co[ax] - cent[0]) * onepluseps + cent[0]; - v1[1] = (l_iter->prev->v->co[ay] - cent[1]) * onepluseps + cent[1]; - - v2[0] = (l_iter->v->co[ax] - cent[0]) * onepluseps + cent[0]; - v2[1] = (l_iter->v->co[ay] - cent[1]) * onepluseps + cent[1]; - - crosses += line_crosses_v2f(v1, v2, co2, out) != 0; - } while ((l_iter = l_iter->next) != l_first); - - return crosses % 2 != 0; + + axis_dominant_v3_to_m3(axis_mat, f->no); + + mul_v2_m3v3(co_2d, axis_mat, co); + + for (i = 0, l_iter = BM_FACE_FIRST_LOOP(f); i < f->len; i++, l_iter = l_iter->next) { + mul_v2_m3v3(projverts[i], axis_mat, l_iter->v->co); + } + + return isect_point_poly_v2(co_2d, (const float (*)[2])projverts, f->len, false); } /** diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c index 685e5443583..40e0356e14c 100644 --- a/source/blender/bmesh/intern/bmesh_queries.c +++ b/source/blender/bmesh/intern/bmesh_queries.c @@ -311,7 +311,7 @@ BMLoop *BM_vert_find_first_loop(BMVert *v) { BMEdge *e; - if (!v || !v->e) + if (!v->e) return NULL; e = bmesh_disk_faceedge_find_first(v->e, v); diff --git a/source/blender/bmesh/intern/bmesh_structure.c b/source/blender/bmesh/intern/bmesh_structure.c index d8313dab36f..3e8002c0192 100644 --- a/source/blender/bmesh/intern/bmesh_structure.c +++ b/source/blender/bmesh/intern/bmesh_structure.c @@ -108,6 +108,7 @@ bool bmesh_edge_swapverts(BMEdge *e, BMVert *v_orig, BMVert *v_new) * - #bmesh_radial_append * - #bmesh_radial_loop_remove * - #bmesh_radial_facevert_count + * - #bmesh_radial_facevert_check * - #bmesh_radial_faceloop_find_first * - #bmesh_radial_faceloop_find_next * - #bmesh_radial_validate @@ -265,7 +266,7 @@ BMEdge *bmesh_disk_faceedge_find_first(const BMEdge *e, const BMVert *v) { const BMEdge *e_find = e; do { - if (e_find->l && bmesh_radial_facevert_count(e_find->l, v)) { + if (e_find->l && bmesh_radial_facevert_check(e_find->l, v)) { return (BMEdge *)e_find; } } while ((e_find = bmesh_disk_edge_next(e_find, v)) != e); @@ -275,10 +276,10 @@ BMEdge *bmesh_disk_faceedge_find_first(const BMEdge *e, const BMVert *v) BMEdge *bmesh_disk_faceedge_find_next(const BMEdge *e, const BMVert *v) { - BMEdge *e_find = NULL; + BMEdge *e_find; e_find = bmesh_disk_edge_next(e, v); do { - if (e_find->l && bmesh_radial_facevert_count(e_find->l, v)) { + if (e_find->l && bmesh_radial_facevert_check(e_find->l, v)) { return e_find; } } while ((e_find = bmesh_disk_edge_next(e_find, v)) != e); @@ -455,6 +456,24 @@ int bmesh_radial_facevert_count(const BMLoop *l, const BMVert *v) return count; } +/** + * \brief RADIAL CHECK FACE VERT + * + * Quicker check for ``bmesh_radial_facevert_count(...) != 0`` + */ +bool bmesh_radial_facevert_check(const BMLoop *l, const BMVert *v) +{ + const BMLoop *l_iter; + l_iter = l; + do { + if (l_iter->v == v) { + return true; + } + } while ((l_iter = l_iter->radial_next) != l); + + return false; +} + /*****loop cycle functions, e.g. loops surrounding a face**** */ bool bmesh_loop_validate(BMFace *f) { diff --git a/source/blender/bmesh/intern/bmesh_structure.h b/source/blender/bmesh/intern/bmesh_structure.h index d2ad655ae75..29868194bbf 100644 --- a/source/blender/bmesh/intern/bmesh_structure.h +++ b/source/blender/bmesh/intern/bmesh_structure.h @@ -61,6 +61,7 @@ void bmesh_radial_loop_remove(BMLoop *l, BMEdge *e) ATTR_NONNULL(1); * just use member access l->radial_next, l->radial_prev now */ int bmesh_radial_facevert_count(const BMLoop *l, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); +bool bmesh_radial_facevert_check(const BMLoop *l, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); BMLoop *bmesh_radial_faceloop_find_first(const BMLoop *l, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); BMLoop *bmesh_radial_faceloop_find_next(const BMLoop *l, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); BMLoop *bmesh_radial_faceloop_find_vert(const BMFace *f, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); diff --git a/source/blender/bmesh/operators/bmo_subdivide.c b/source/blender/bmesh/operators/bmo_subdivide.c index fc507cdbd21..0d9ce4b2731 100644 --- a/source/blender/bmesh/operators/bmo_subdivide.c +++ b/source/blender/bmesh/operators/bmo_subdivide.c @@ -32,6 +32,7 @@ #include "BLI_rand.h" #include "BLI_array.h" #include "BLI_noise.h" +#include "BLI_stack.h" #include "BKE_customdata.h" @@ -766,8 +767,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op) BMOpSlot *einput; const SubDPattern *pat; SubDParams params; - SubDFaceData *facedata = NULL; - BLI_array_declare(facedata); + BLI_Stack *facedata; BMIter viter, fiter, liter; BMVert *v, **verts = NULL; BMEdge *edge; @@ -782,7 +782,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op) BLI_array_declare(verts); float smooth, fractal, along_normal; bool use_sphere, use_single_edge, use_grid_fill, use_only_quads; - int cornertype, seed, i, j, matched, a, b, numcuts, totesel, smooth_falloff; + int cornertype, seed, i, j, a, b, numcuts, totesel, smooth_falloff; BMO_slot_buffer_flag_enable(bm, op->slots_in, "edges", BM_EDGE, SUBD_SPLIT); @@ -875,9 +875,12 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op) BM_EDGE, EDGE_PERCENT); + facedata = BLI_stack_new(sizeof(SubDFaceData), __func__); + BM_ITER_MESH (face, &fiter, bm, BM_FACES_OF_MESH) { BMEdge *e1 = NULL, *e2 = NULL; float vec1[3], vec2[3]; + bool matched = false; /* skip non-quads if requested */ if (use_only_quads && face->len != 4) @@ -891,8 +894,6 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op) BLI_array_grow_items(edges, face->len); BLI_array_grow_items(verts, face->len); - matched = 0; - totesel = 0; BM_ITER_ELEM_INDEX (l_new, &liter, face, BM_LOOPS_OF_FACE, i) { edges[i] = l_new->e; @@ -930,12 +931,13 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op) } } if (matched) { - BLI_array_grow_one(facedata); - b = BLI_array_count(facedata) - 1; - facedata[b].pat = pat; - facedata[b].start = verts[i]; - facedata[b].face = face; - facedata[b].totedgesel = totesel; + SubDFaceData *fd; + + fd = BLI_stack_push_r(facedata); + fd->pat = pat; + fd->start = verts[i]; + fd->face = face; + fd->totedgesel = totesel; BMO_elem_flag_enable(bm, face, SUBD_SPLIT); break; } @@ -966,15 +968,15 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op) } } if (matched) { - BLI_array_grow_one(facedata); - j = BLI_array_count(facedata) - 1; + SubDFaceData *fd; BMO_elem_flag_enable(bm, face, SUBD_SPLIT); - facedata[j].pat = pat; - facedata[j].start = verts[a]; - facedata[j].face = face; - facedata[j].totedgesel = totesel; + fd = BLI_stack_push_r(facedata); + fd->pat = pat; + fd->start = verts[a]; + fd->face = face; + fd->totedgesel = totesel; break; } } @@ -982,16 +984,16 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op) } if (!matched && totesel) { - BLI_array_grow_one(facedata); - j = BLI_array_count(facedata) - 1; + SubDFaceData *fd; BMO_elem_flag_enable(bm, face, SUBD_SPLIT); /* must initialize all members here */ - facedata[j].start = NULL; - facedata[j].pat = NULL; - facedata[j].totedgesel = totesel; - facedata[j].face = face; + fd = BLI_stack_push_r(facedata); + fd->start = NULL; + fd->pat = NULL; + fd->totedgesel = totesel; + fd->face = face; } } @@ -1009,16 +1011,17 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op) copy_v3_v3(v->co, co); } - i = 0; - for (i = 0; i < BLI_array_count(facedata); i++) { - face = facedata[i].face; + for (; !BLI_stack_is_empty(facedata); BLI_stack_discard(facedata)) { + SubDFaceData *fd = BLI_stack_peek(facedata); + + face = fd->face; /* figure out which pattern to use */ BLI_array_empty(verts); - pat = facedata[i].pat; + pat = fd->pat; - if (!pat && facedata[i].totedgesel == 2) { + if (!pat && fd->totedgesel == 2) { int vlen; /* ok, no pattern. we still may be able to do something */ @@ -1131,7 +1134,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op) a = 0; BM_ITER_ELEM_INDEX (l_new, &liter, face, BM_LOOPS_OF_FACE, j) { - if (l_new->v == facedata[i].start) { + if (l_new->v == fd->start) { a = j + 1; break; } @@ -1156,7 +1159,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op) BM_data_layer_free_n(bm, &bm->vdata, CD_SHAPEKEY, params.shape_info.tmpkey); - if (facedata) BLI_array_free(facedata); + BLI_stack_free(facedata); if (edges) BLI_array_free(edges); if (verts) BLI_array_free(verts); BLI_array_free(loops_split); diff --git a/source/blender/bmesh/operators/bmo_utils.c b/source/blender/bmesh/operators/bmo_utils.c index d2d1c0854de..a06d40c8c0f 100644 --- a/source/blender/bmesh/operators/bmo_utils.c +++ b/source/blender/bmesh/operators/bmo_utils.c @@ -291,6 +291,7 @@ void bmo_smooth_vert_exec(BMesh *UNUSED(bm), BMOperator *op) BMEdge *e; float (*cos)[3] = MEM_mallocN(sizeof(*cos) * BMO_slot_buffer_count(op->slots_in, "verts"), __func__); float *co, *co2, clip_dist = BMO_slot_float_get(op->slots_in, "clip_dist"); + const float fac = BMO_slot_float_get(op->slots_in, "factor"); int i, j, clipx, clipy, clipz; int xaxis, yaxis, zaxis; @@ -322,7 +323,7 @@ void bmo_smooth_vert_exec(BMesh *UNUSED(bm), BMOperator *op) } mul_v3_fl(co, 1.0f / (float)j); - mid_v3_v3v3(co, co, v->co); + interp_v3_v3v3(co, v->co, co, fac); if (clipx && fabsf(v->co[0]) <= clip_dist) co[0] = 0.0f; diff --git a/source/blender/bmesh/tools/bmesh_bisect_plane.c b/source/blender/bmesh/tools/bmesh_bisect_plane.c index ae9b882cea0..ed9e8783037 100644 --- a/source/blender/bmesh/tools/bmesh_bisect_plane.c +++ b/source/blender/bmesh/tools/bmesh_bisect_plane.c @@ -53,7 +53,7 @@ /* -------------------------------------------------------------------- */ /* Math utils */ -static int plane_point_test_v3(const float plane[4], const float co[3], const float eps, float *r_depth) +static short plane_point_test_v3(const float plane[4], const float co[3], const float eps, float *r_depth) { const float f = plane_point_side_v3(plane, co); *r_depth = f; @@ -69,7 +69,8 @@ static int plane_point_test_v3(const float plane[4], const float co[3], const fl * later we may want to move this into some hash lookup * to a separate struct, but for now we can store in BMesh data */ -#define BM_VERT_DIR(v) ((v)->head.index) /* Direction -1/0/1 */ +#define BM_VERT_DIR(v) ((short *)(&(v)->head.index))[0] /* Direction -1/0/1 */ +#define BM_VERT_SKIP(v) ((short *)(&(v)->head.index))[1] /* Skip Vert 0/1 */ #define BM_VERT_DIST(v) ((v)->no[0]) /* Distance from the plane. */ #define BM_VERT_SORTVAL(v) ((v)->no[1]) /* Temp value for sorting. */ #define BM_VERT_LOOPINDEX(v) /* The verts index within a face (temp var) */ \ @@ -117,6 +118,7 @@ static void bm_face_bisect_verts(BMesh *bm, BMFace *f, const float plane[4], con STACK_DECLARE(vert_split_arr); BMLoop *l_iter, *l_first; bool use_dirs[3] = {false, false, false}; + bool is_inside = false; STACK_INIT(vert_split_arr, f_len_orig); @@ -129,6 +131,11 @@ static void bm_face_bisect_verts(BMesh *bm, BMFace *f, const float plane[4], con do { if (vert_is_center_test(l_iter->v)) { BLI_assert(BM_VERT_DIR(l_iter->v) == 0); + + /* if both are -1 or 1, or both are zero: + * don't flip 'inside' var while walking */ + BM_VERT_SKIP(l_iter->v) = (((BM_VERT_DIR(l_iter->prev->v) ^ BM_VERT_DIR(l_iter->next->v))) == 0); + STACK_PUSH(vert_split_arr, l_iter->v); } use_dirs[BM_VERT_DIR(l_iter->v) + 1] = true; @@ -230,15 +237,12 @@ static void bm_face_bisect_verts(BMesh *bm, BMFace *f, const float plane[4], con for (i = 0; i < STACK_SIZE(vert_split_arr) - 1; i++) { BMVert *v_a = vert_split_arr[i]; BMVert *v_b = vert_split_arr[i + 1]; - float co_mid[2]; - /* geometric test before doing face lookups, - * find if the split spans a filled region of the polygon. */ - mid_v2_v2v2(co_mid, - face_verts_proj_2d[BM_VERT_LOOPINDEX(v_a)], - face_verts_proj_2d[BM_VERT_LOOPINDEX(v_b)]); + if (!BM_VERT_SKIP(v_a)) { + is_inside = !is_inside; + } - if (isect_point_poly_v2(co_mid, (const float (*)[2])face_verts_proj_2d, f_len_orig, false)) { + if (is_inside) { BMLoop *l_a, *l_b; bool found = false; unsigned int j; @@ -254,7 +258,8 @@ static void bm_face_bisect_verts(BMesh *bm, BMFace *f, const float plane[4], con } } - BLI_assert(found == true); + /* ideally wont happen, but it can for self intersecting faces */ + // BLI_assert(found == true); /* in fact this simple test is good enough, * test if the loops are adjacent */ diff --git a/source/blender/bmesh/tools/bmesh_region_match.c b/source/blender/bmesh/tools/bmesh_region_match.c new file mode 100644 index 00000000000..050d5ae4808 --- /dev/null +++ b/source/blender/bmesh/tools/bmesh_region_match.c @@ -0,0 +1,1511 @@ +/* + * ***** 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. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/bmesh/tools/bmesh_region_match.c + * \ingroup bmesh + * + * Given a contiguous region of faces, + * find multiple matching regions (based on topology) and return them. + * + * Implementation: + * + * - Given a face region, find its topological center. + * - Compare this with other vertices surrounding geometry with this ones. + * (reduce the search space by creating a connectivity ID per vertex + * and only run comprehensive tests on those). + * - All hashes must be order independent so matching topology can be identified. + * - The term UUID here doesn't mean each ID is initially unique. + * (uniqueness is improved by re-hashing with connected data). + */ + +#include <string.h> + +#include "MEM_guardedalloc.h" +#include "BLI_listbase.h" +#include "BLI_linklist.h" +#include "BLI_alloca.h" +#include "BLI_ghash.h" +#include "BLI_mempool.h" +#include "BLI_linklist_stack.h" + +#include "bmesh.h" + +#include "tools/bmesh_region_match.h" /* own incldue */ + +/* avoid re-creating ghash and pools for each search */ +#define USE_WALKER_REUSE + +/* do a first-pass id of all vertices, + * this avoids expensive checks on every item later on + * (works fine without, just slower) */ +#define USE_PIVOT_FASTMATCH + +/* otherwise use active element as pivot, for quick tests only */ +#define USE_PIVOT_SEARCH + +// #define DEBUG_TIME +// #define DEBUG_PRINT + +#ifdef DEBUG_TIME +# include "PIL_time.h" +# include "PIL_time_utildefines.h" +#endif + +#include "BLI_strict_flags.h" + + +/* -------------------------------------------------------------------- */ +/* UUID-Walk API */ + +/** \name Internal UUIDWalk API + * \{ */ + +#define PRIME_VERT_INIT 100003 + +typedef uintptr_t UUID_Int; + +typedef struct UUIDWalk { + + /* List of faces we can step onto (UUIDFaceStep's) */ + ListBase faces_step; + + /* Face & Vert UUID's */ + GHash *verts_uuid; + GHash *faces_uuid; + + /* memory pool for LinkNode's */ + BLI_mempool *link_pool; + + /* memory pool for LinkBase's */ + BLI_mempool *lbase_pool; + + /* memory pool for UUIDFaceStep's */ + BLI_mempool *step_pool; + BLI_mempool *step_pool_items; + + /* Optionaly use face-tag to isolate search */ + bool use_face_isolate; + + /* Increment for each pass added */ + UUID_Int pass; + + /* runtime vars, aviod re-creating each pass */ + struct { + GHash *verts_uuid; /* BMVert -> UUID */ + GSet *faces_step; /* BMFace */ + + GHash *faces_from_uuid; /* UUID -> UUIDFaceStepItem */ + + UUID_Int *rehash_store; + unsigned int rehash_store_len; + } cache; + +} UUIDWalk; + +/* stores a set of potential faces to step onto */ +typedef struct UUIDFaceStep { + struct UUIDFaceStep *next, *prev; + + /* unsorted 'BMFace' */ + LinkNode *faces; + + /* faces sorted into 'UUIDFaceStepItem' */ + ListBase items; +} UUIDFaceStep; + +/* store face-lists with same uuid */ +typedef struct UUIDFaceStepItem { + struct UUIDFaceStepItem *next, *prev; + uintptr_t uuid; + + LinkNode *list; + unsigned int list_len; +} UUIDFaceStepItem; + +BLI_INLINE bool bm_uuidwalk_face_test( + UUIDWalk *uuidwalk, BMFace *f) +{ + if (uuidwalk->use_face_isolate) { + return BM_elem_flag_test_bool(f, BM_ELEM_TAG); + } + else { + return true; + } +} + +BLI_INLINE bool bm_uuidwalk_vert_lookup( + UUIDWalk *uuidwalk, BMVert *v, UUID_Int *r_uuid) +{ + void **ret; + ret = BLI_ghash_lookup_p(uuidwalk->verts_uuid, v); + if (ret) { + *r_uuid = (UUID_Int)(*ret); + return true; + } + else { + return false; + } +} + +BLI_INLINE bool bm_uuidwalk_face_lookup( + UUIDWalk *uuidwalk, BMFace *f, UUID_Int *r_uuid) +{ + void **ret; + ret = BLI_ghash_lookup_p(uuidwalk->faces_uuid, f); + if (ret) { + *r_uuid = (UUID_Int)(*ret); + return true; + } + else { + return false; + } +} + +static unsigned int ghashutil_bmelem_indexhash(const void *key) +{ + const BMElem *ele = key; + return (unsigned int)BM_elem_index_get(ele); +} + +static bool ghashutil_bmelem_indexcmp(const void *a, const void *b) +{ + BLI_assert((a != b) == (BM_elem_index_get((BMElem *)a) != BM_elem_index_get((BMElem *)b))); + return (a != b); +} + +static GHash *ghash_bmelem_new_ex(const char *info, + const unsigned int nentries_reserve) +{ + return BLI_ghash_new_ex(ghashutil_bmelem_indexhash, ghashutil_bmelem_indexcmp, info, nentries_reserve); +} + +static GSet *gset_bmelem_new_ex(const char *info, + const unsigned int nentries_reserve) +{ + return BLI_gset_new_ex(ghashutil_bmelem_indexhash, ghashutil_bmelem_indexcmp, info, nentries_reserve); +} + + +static GHash *ghash_bmelem_new(const char *info) +{ + return ghash_bmelem_new_ex(info, 0); +} + +static GSet *gset_bmelem_new(const char *info) +{ + return gset_bmelem_new_ex(info, 0); +} + + +static void bm_uuidwalk_init( + UUIDWalk *uuidwalk, + const unsigned int faces_src_region_len, + const unsigned int verts_src_region_len) +{ + BLI_listbase_clear(&uuidwalk->faces_step); + + uuidwalk->verts_uuid = ghash_bmelem_new_ex(__func__, verts_src_region_len); + uuidwalk->faces_uuid = ghash_bmelem_new_ex(__func__, faces_src_region_len); + + uuidwalk->cache.verts_uuid = ghash_bmelem_new(__func__); + uuidwalk->cache.faces_step = gset_bmelem_new(__func__); + + /* works because 'int' ghash works for intptr_t too */ + uuidwalk->cache.faces_from_uuid = BLI_ghash_int_new(__func__); + + uuidwalk->cache.rehash_store = NULL; + uuidwalk->cache.rehash_store_len = 0; + + uuidwalk->use_face_isolate = false; + + /* smaller pool's for faster clearing */ + uuidwalk->link_pool = BLI_mempool_create(sizeof(LinkNode), 64, 64, BLI_MEMPOOL_NOP); + uuidwalk->step_pool = BLI_mempool_create(sizeof(UUIDFaceStep), 64, 64, BLI_MEMPOOL_NOP); + uuidwalk->step_pool_items = BLI_mempool_create(sizeof(UUIDFaceStepItem), 64, 64, BLI_MEMPOOL_NOP); + + uuidwalk->pass = 1; +} + +static void bm_uuidwalk_clear( + UUIDWalk *uuidwalk) +{ + BLI_listbase_clear(&uuidwalk->faces_step); + + BLI_ghash_clear(uuidwalk->verts_uuid, NULL, NULL); + BLI_ghash_clear(uuidwalk->faces_uuid, NULL, NULL); + + BLI_ghash_clear(uuidwalk->cache.verts_uuid, NULL, NULL); + BLI_gset_clear(uuidwalk->cache.faces_step, NULL); + BLI_ghash_clear(uuidwalk->cache.faces_from_uuid, NULL, NULL); + + /* keep rehash_store as-is, for reuse */ + + uuidwalk->use_face_isolate = false; + + BLI_mempool_clear(uuidwalk->link_pool); + BLI_mempool_clear(uuidwalk->step_pool); + BLI_mempool_clear(uuidwalk->step_pool_items); + + uuidwalk->pass = 1; +} + +static void bm_uuidwalk_free( + UUIDWalk *uuidwalk) +{ + /** + * Handled by pools + * + * - uuidwalk->faces_step + */ + + BLI_ghash_free(uuidwalk->verts_uuid, NULL, NULL); + BLI_ghash_free(uuidwalk->faces_uuid, NULL, NULL); + + /* cache */ + BLI_ghash_free(uuidwalk->cache.verts_uuid, NULL, NULL); + BLI_gset_free(uuidwalk->cache.faces_step, NULL); + BLI_ghash_free(uuidwalk->cache.faces_from_uuid, NULL, NULL); + MEM_SAFE_FREE(uuidwalk->cache.rehash_store); + + BLI_mempool_destroy(uuidwalk->link_pool); + BLI_mempool_destroy(uuidwalk->step_pool); + BLI_mempool_destroy(uuidwalk->step_pool_items); +} + +static UUID_Int bm_uuidwalk_calc_vert_uuid( + UUIDWalk *uuidwalk, BMVert *v) +{ +#define PRIME_VERT_SMALL 7 +#define PRIME_VERT_MID 43 +#define PRIME_VERT_LARGE 1031 + +#define PRIME_FACE_SMALL 13 +#define PRIME_FACE_MID 53 + + UUID_Int uuid; + + uuid = uuidwalk->pass * PRIME_VERT_LARGE; + + /* vert -> other */ + { + unsigned int tot = 0; + BMIter eiter; + BMEdge *e; + BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) { + BMVert *v_other = BM_edge_other_vert(e, v); + UUID_Int uuid_other; + if (bm_uuidwalk_vert_lookup(uuidwalk, v_other, &uuid_other)) { + uuid ^= (uuid_other * PRIME_VERT_SMALL); + tot += 1; + } + } + uuid ^= (tot * PRIME_VERT_MID); + } + + /* faces */ + { + unsigned int tot = 0; + BMIter iter; + BMFace *f; + + BM_ITER_ELEM (f, &iter, v, BM_FACES_OF_VERT) { + UUID_Int uuid_other; + if (bm_uuidwalk_face_lookup(uuidwalk, f, &uuid_other)) { + uuid ^= (uuid_other * PRIME_FACE_SMALL); + tot += 1; + } + } + uuid ^= (tot * PRIME_FACE_MID); + } + + return uuid; + +#undef PRIME_VERT_SMALL +#undef PRIME_VERT_MID +#undef PRIME_VERT_LARGE + +#undef PRIME_FACE_SMALL +#undef PRIME_FACE_MID +} + +static UUID_Int bm_uuidwalk_calc_face_uuid( + UUIDWalk *uuidwalk, BMFace *f) +{ +#define PRIME_VERT_SMALL 11 + +#define PRIME_FACE_SMALL 17 +#define PRIME_FACE_LARGE 1013 + + UUID_Int uuid; + + uuid = uuidwalk->pass * (unsigned int)f->len * PRIME_FACE_LARGE; + + /* face-verts */ + { + BMLoop *l_iter, *l_first; + + l_iter = l_first = BM_FACE_FIRST_LOOP(f); + do { + UUID_Int uuid_other; + if (bm_uuidwalk_vert_lookup(uuidwalk, l_iter->v, &uuid_other)) { + uuid ^= (uuid_other * PRIME_VERT_SMALL); + } + } while ((l_iter = l_iter->next) != l_first); + } + + /* face-faces (connected by edge) */ + { + BMLoop *l_iter, *l_first; + + l_iter = l_first = BM_FACE_FIRST_LOOP(f); + do { + if (l_iter->radial_next != l_iter) { + BMLoop *l_iter_radial = l_iter->radial_next; + do { + UUID_Int uuid_other; + if (bm_uuidwalk_face_lookup(uuidwalk, l_iter_radial->f, &uuid_other)) { + uuid ^= (uuid_other * PRIME_FACE_SMALL); + } + } while ((l_iter_radial = l_iter_radial->radial_next) != l_iter); + } + } while ((l_iter = l_iter->next) != l_first); + } + + return uuid; + +#undef PRIME_VERT_SMALL + +#undef PRIME_FACE_SMALL +#undef PRIME_FACE_LARGE +} + +static void bm_uuidwalk_rehash_reserve( + UUIDWalk *uuidwalk, unsigned int rehash_store_len_new) +{ + if (UNLIKELY(rehash_store_len_new > uuidwalk->cache.rehash_store_len)) { + /* avoid re-allocs */ + rehash_store_len_new *= 2; + uuidwalk->cache.rehash_store = + MEM_reallocN(uuidwalk->cache.rehash_store, + rehash_store_len_new * sizeof(*uuidwalk->cache.rehash_store)); + uuidwalk->cache.rehash_store_len = rehash_store_len_new; + } +} + +/** + * Re-hash all elements, delay updating so as not to create feedback loop. + */ +static void bm_uuidwalk_rehash( + UUIDWalk *uuidwalk) +{ + GHashIterator gh_iter; + UUID_Int *uuid_store; + unsigned int i; + + unsigned int rehash_store_len_new = (unsigned int)MAX2(BLI_ghash_size(uuidwalk->verts_uuid), + BLI_ghash_size(uuidwalk->faces_uuid)); + + bm_uuidwalk_rehash_reserve(uuidwalk, rehash_store_len_new); + uuid_store = uuidwalk->cache.rehash_store; + + /* verts */ + i = 0; + GHASH_ITER (gh_iter, uuidwalk->verts_uuid) { + BMVert *v = BLI_ghashIterator_getKey(&gh_iter); + uuid_store[i++] = bm_uuidwalk_calc_vert_uuid(uuidwalk, v); + } + i = 0; + GHASH_ITER (gh_iter, uuidwalk->verts_uuid) { + void **uuid_p = BLI_ghashIterator_getValue_p(&gh_iter); + *((UUID_Int *)uuid_p) = uuid_store[i++]; + } + + /* faces */ + i = 0; + GHASH_ITER (gh_iter, uuidwalk->faces_uuid) { + BMFace *f = BLI_ghashIterator_getKey(&gh_iter); + uuid_store[i++] = bm_uuidwalk_calc_face_uuid(uuidwalk, f); + } + i = 0; + GHASH_ITER (gh_iter, uuidwalk->faces_uuid) { + void **uuid_p = BLI_ghashIterator_getValue_p(&gh_iter); + *((UUID_Int *)uuid_p) = uuid_store[i++]; + } +} + +static void bm_uuidwalk_rehash_facelinks( + UUIDWalk *uuidwalk, + LinkNode *faces, const unsigned int faces_len, + const bool is_init) +{ + UUID_Int *uuid_store; + LinkNode *f_link; + unsigned int i; + + bm_uuidwalk_rehash_reserve(uuidwalk, faces_len); + uuid_store = uuidwalk->cache.rehash_store; + + i = 0; + for (f_link = faces; f_link; f_link = f_link->next) { + BMFace *f = f_link->link; + uuid_store[i++] = bm_uuidwalk_calc_face_uuid(uuidwalk, f); + } + + i = 0; + if (is_init) { + for (f_link = faces; f_link; f_link = f_link->next) { + BMFace *f = f_link->link; + BLI_ghash_insert(uuidwalk->faces_uuid, f, (void *)uuid_store[i++]); + } + } + else { + for (f_link = faces; f_link; f_link = f_link->next) { + BMFace *f = f_link->link; + void **uuid_p = BLI_ghash_lookup_p(uuidwalk->faces_uuid, f); + *((UUID_Int *)uuid_p) = uuid_store[i++]; + } + } +} + +static bool bm_vert_is_uuid_connect( + UUIDWalk *uuidwalk, BMVert *v) +{ + BMIter eiter; + BMEdge *e; + + BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) { + BMVert *v_other = BM_edge_other_vert(e, v); + if (BLI_ghash_haskey(uuidwalk->verts_uuid, v_other)) { + return true; + } + } + return false; +} + +static void bm_uuidwalk_pass_add( + UUIDWalk *uuidwalk, LinkNode *faces_pass, const unsigned int faces_pass_len) +{ + GHashIterator gh_iter; + GHash *verts_uuid_pass; + GSet *faces_step_next; + LinkNode *f_link; + + UUIDFaceStep *fstep; + + BLI_assert(faces_pass_len == (unsigned int)BLI_linklist_length(faces_pass)); + + /* rehash faces now all their verts have been added */ + bm_uuidwalk_rehash_facelinks(uuidwalk, faces_pass, faces_pass_len, true); + + /* create verts_new */ + verts_uuid_pass = uuidwalk->cache.verts_uuid; + faces_step_next = uuidwalk->cache.faces_step; + + BLI_assert(BLI_ghash_size(verts_uuid_pass) == 0); + BLI_assert(BLI_gset_size(faces_step_next) == 0); + + /* Add the face_step data from connected faces, creating new passes */ + fstep = BLI_mempool_alloc(uuidwalk->step_pool); + BLI_addhead(&uuidwalk->faces_step, fstep); + fstep->faces = NULL; + BLI_listbase_clear(&fstep->items); + + for (f_link = faces_pass; f_link; f_link = f_link->next) { + BMFace *f = f_link->link; + BMLoop *l_iter, *l_first; + + l_iter = l_first = BM_FACE_FIRST_LOOP(f); + do { + /* fill verts_new */ + if (!BLI_ghash_haskey(uuidwalk->verts_uuid, l_iter->v) && + !BLI_ghash_haskey(verts_uuid_pass, l_iter->v) && + (bm_vert_is_uuid_connect(uuidwalk, l_iter->v) == true)) + { + const UUID_Int uuid = bm_uuidwalk_calc_vert_uuid(uuidwalk, l_iter->v); + BLI_ghash_insert(verts_uuid_pass, l_iter->v, (void *)uuid); + } + + /* fill faces_step_next */ + if (l_iter->radial_next != l_iter) { + BMLoop *l_iter_radial = l_iter->radial_next; + do { + if (!BLI_ghash_haskey(uuidwalk->faces_uuid, l_iter_radial->f) && + !BLI_gset_haskey(faces_step_next, l_iter_radial->f) && + (bm_uuidwalk_face_test(uuidwalk, l_iter_radial->f))) + { + BLI_gset_insert(faces_step_next, l_iter_radial->f); + + /* add to fstep */ + BLI_linklist_prepend_pool(&fstep->faces, l_iter_radial->f, uuidwalk->link_pool); + } + } while ((l_iter_radial = l_iter_radial->radial_next) != l_iter); + } + } while ((l_iter = l_iter->next) != l_first); + } + + /* faces_uuid.update(verts_new) */ + GHASH_ITER (gh_iter, verts_uuid_pass) { + BMVert *v = BLI_ghashIterator_getKey(&gh_iter); + void *uuid_p = BLI_ghashIterator_getValue(&gh_iter); + BLI_ghash_insert(uuidwalk->verts_uuid, v, uuid_p); + } + + /* rehash faces now all their verts have been added */ + bm_uuidwalk_rehash_facelinks(uuidwalk, faces_pass, faces_pass_len, false); + + uuidwalk->pass += 1; + + BLI_ghash_clear(uuidwalk->cache.verts_uuid, NULL, NULL); + BLI_gset_clear(uuidwalk->cache.faces_step, NULL); +} + +static int bm_face_len_cmp(const void *v1, const void *v2) +{ + const BMFace *f1 = v1, *f2 = v2; + + if (f1->len > f2->len) return 1; + else if (f1->len < f2->len) return -1; + else return 0; +} + +static unsigned int bm_uuidwalk_init_from_edge( + UUIDWalk *uuidwalk, BMEdge *e) +{ + BMLoop *l_iter = e->l; + unsigned int f_arr_len = (unsigned int)BM_edge_face_count(e); + BMFace **f_arr = BLI_array_alloca(f_arr, f_arr_len); + unsigned int fstep_num = 0, i = 0; + + do { + BMFace *f = l_iter->f; + if (bm_uuidwalk_face_test(uuidwalk, f)) { + f_arr[i++] = f; + } + } while ((l_iter = l_iter->radial_next) != e->l); + BLI_assert(i <= f_arr_len); + f_arr_len = i; + + qsort(f_arr, f_arr_len, sizeof(*f_arr), bm_face_len_cmp); + + /* start us off! */ + { + const UUID_Int uuid = PRIME_VERT_INIT; + BLI_ghash_insert(uuidwalk->verts_uuid, e->v1, (void *)uuid); + BLI_ghash_insert(uuidwalk->verts_uuid, e->v2, (void *)uuid); + } + + /* turning an array into LinkNode's seems odd, + * but this is just for initialization, + * elsewhere using LinkNode's makes more sense */ + for (i = 0; i < f_arr_len; i++) { + LinkNode *faces_pass = NULL; + const int f_len = f_arr[i]->len; + + do { + BLI_linklist_prepend_pool(&faces_pass, f_arr[i++], uuidwalk->link_pool); + } while (i < f_arr_len && (f_len == f_arr[i]->len)); + + bm_uuidwalk_pass_add(uuidwalk, faces_pass, i); + BLI_linklist_free_pool(faces_pass, NULL, uuidwalk->link_pool); + fstep_num += 1; + } + + return fstep_num; +} + +#undef PRIME_VERT_INIT + +/** \} */ + + +/** \name Internal UUIDFaceStep API + * \{ */ + +static int facestep_sort(const void *a, const void *b) +{ + const UUIDFaceStepItem *fstep_a = a; + const UUIDFaceStepItem *fstep_b = b; + return (fstep_a->uuid > fstep_b->uuid) ? 1 : 0; +} + +/** + * Put faces in lists based on their uuid's, + * re-run for each pass since rehashing may differentiate face-groups. + */ +static bool bm_uuidwalk_facestep_begin( + UUIDWalk *uuidwalk, UUIDFaceStep *fstep) +{ + LinkNode *f_link, *f_link_next, **f_link_prev_p; + bool ok = false; + + BLI_assert(BLI_ghash_size(uuidwalk->cache.faces_from_uuid) == 0); + BLI_assert(BLI_countlist(&fstep->items) == 0); + + f_link_prev_p = &fstep->faces; + for (f_link = fstep->faces; f_link; f_link = f_link_next) { + BMFace *f = f_link->link; + f_link_next = f_link->next; + + /* possible another pass added this face already, free in that case */ + if (!BLI_ghash_haskey(uuidwalk->faces_uuid, f)) { + const UUID_Int uuid = bm_uuidwalk_calc_face_uuid(uuidwalk, f); + UUIDFaceStepItem *fstep_item; + + ok = true; + + fstep_item = BLI_ghash_lookup(uuidwalk->cache.faces_from_uuid, (void *)uuid); + if (UNLIKELY(fstep_item == NULL)) { + fstep_item = BLI_mempool_alloc(uuidwalk->step_pool_items); + BLI_ghash_insert(uuidwalk->cache.faces_from_uuid, (void *)uuid, fstep_item); + + /* add to start, so its handled on the next round of passes */ + BLI_addhead(&fstep->items, fstep_item); + fstep_item->uuid = uuid; + fstep_item->list = NULL; + fstep_item->list_len = 0; + } + + BLI_linklist_prepend_pool(&fstep_item->list, f, uuidwalk->link_pool); + fstep_item->list_len += 1; + + f_link_prev_p = &f_link->next; + } + else { + *f_link_prev_p = f_link->next; + BLI_mempool_free(uuidwalk->link_pool, f_link); + } + } + + BLI_ghash_clear(uuidwalk->cache.faces_from_uuid, NULL, NULL); + + BLI_sortlist(&fstep->items, facestep_sort); + + return ok; +} + +/** + * Cleans up temp data from #bm_uuidwalk_facestep_begin + */ +static void bm_uuidwalk_facestep_end( + UUIDWalk *uuidwalk, UUIDFaceStep *fstep) +{ + UUIDFaceStepItem *fstep_item; + + while ((fstep_item = BLI_pophead(&fstep->items))) { + BLI_mempool_free(uuidwalk->step_pool_items, fstep_item); + } +} + +static void bm_uuidwalk_facestep_free( + UUIDWalk *uuidwalk, UUIDFaceStep *fstep) +{ + LinkNode *f_link, *f_link_next; + + BLI_assert(BLI_listbase_is_empty(&fstep->items)); + + for (f_link = fstep->faces; f_link; f_link = f_link_next) { + f_link_next = f_link->next; + BLI_mempool_free(uuidwalk->link_pool, f_link); + } + + BLI_remlink(&uuidwalk->faces_step, fstep); + BLI_mempool_free(uuidwalk->step_pool, fstep); +} + +/** \} */ + + +/* -------------------------------------------------------------------- */ +/* Main Loop to match up regions */ + +/** + * Given a face region and 2 candidate verts to begin mapping. + * return the matching region or NULL. + */ +static BMFace **bm_mesh_region_match_pair( +#ifdef USE_WALKER_REUSE + UUIDWalk *w_src, UUIDWalk *w_dst, +#endif + BMEdge *e_src, BMEdge *e_dst, + const unsigned int faces_src_region_len, + const unsigned int verts_src_region_len, + unsigned int *r_faces_result_len) +{ +#ifndef USE_WALKER_REUSE + UUIDWalk w_src_, w_dst_; + UUIDWalk *w_src = &w_src_, *w_dst = &w_dst_; +#endif + BMFace **faces_result = NULL; + bool found = false; + + BLI_assert(e_src != e_dst); + +#ifndef USE_WALKER_REUSE + bm_uuidwalk_init(w_src, faces_src_region_len, verts_src_region_len); + bm_uuidwalk_init(w_dst, faces_src_region_len, verts_src_region_len); +#endif + + w_src->use_face_isolate = true; + + /* setup the initial state */ + if (UNLIKELY(bm_uuidwalk_init_from_edge(w_src, e_src) != + bm_uuidwalk_init_from_edge(w_dst, e_dst))) + { + /* should never happen, if verts passed are compatible, but to be safe... */ + goto finally; + } + + bm_uuidwalk_rehash_reserve(w_src, MAX2(faces_src_region_len, verts_src_region_len)); + bm_uuidwalk_rehash_reserve(w_dst, MAX2(faces_src_region_len, verts_src_region_len)); + + while (true) { + bool ok = false; + + UUIDFaceStep *fstep_src = w_src->faces_step.first; + UUIDFaceStep *fstep_dst = w_dst->faces_step.first; + + BLI_assert(BLI_countlist(&w_src->faces_step) == BLI_countlist(&w_dst->faces_step)); + + while (fstep_src) { + + /* even if the destination has faces, + * it's not important, since the source doesn't, free and move-on. */ + if (fstep_src->faces == NULL) { + UUIDFaceStep *fstep_src_next = fstep_src->next; + UUIDFaceStep *fstep_dst_next = fstep_dst->next; + bm_uuidwalk_facestep_free(w_src, fstep_src); + bm_uuidwalk_facestep_free(w_dst, fstep_dst); + fstep_src = fstep_src_next; + fstep_dst = fstep_dst_next; + continue; + } + + if (bm_uuidwalk_facestep_begin(w_src, fstep_src) && + bm_uuidwalk_facestep_begin(w_dst, fstep_dst)) + { + /* Step over face-lists with matching UUID's + * both lists are sorted, so no need for lookups. + * The data is created on 'begin' and cleared on 'end' */ + UUIDFaceStepItem *fstep_item_src; + UUIDFaceStepItem *fstep_item_dst; + for (fstep_item_src = fstep_src->items.first, + fstep_item_dst = fstep_dst->items.first; + fstep_item_src && fstep_item_dst; + fstep_item_src = fstep_item_src->next, + fstep_item_dst = fstep_item_dst->next) + { + while ((fstep_item_dst != NULL) && + (fstep_item_dst->uuid < fstep_item_src->uuid)) + { + fstep_item_dst = fstep_item_dst->next; + } + + if ((fstep_item_dst == NULL) || + (fstep_item_src->uuid != fstep_item_dst->uuid) || + (fstep_item_src->list_len > fstep_item_dst->list_len)) + { + /* if the target walker has less than the source + * then the islands don't match, bail early */ + ok = false; + break; + } + + if (fstep_item_src->list_len == fstep_item_dst->list_len) { + /* found a match */ + bm_uuidwalk_pass_add(w_src, fstep_item_src->list, fstep_item_src->list_len); + bm_uuidwalk_pass_add(w_dst, fstep_item_dst->list, fstep_item_dst->list_len); + + BLI_linklist_free_pool(fstep_item_src->list, NULL, w_src->link_pool); + BLI_linklist_free_pool(fstep_item_dst->list, NULL, w_dst->link_pool); + + fstep_item_src->list = NULL; + fstep_item_src->list_len = 0; + + fstep_item_dst->list = NULL; + fstep_item_dst->list_len = 0; + + ok = true; + } + } + } + + bm_uuidwalk_facestep_end(w_src, fstep_src); + bm_uuidwalk_facestep_end(w_dst, fstep_dst); + + /* lock-step */ + fstep_src = fstep_src->next; + fstep_dst = fstep_dst->next; + } + + if (!ok) { + break; + } + + found = ((unsigned int)BLI_ghash_size(w_dst->faces_uuid) == faces_src_region_len); + if (found) { + break; + } + + /* Expensive! but some cases fails without. + * (also faster in other cases since it can rule-out invalid regions) */ + bm_uuidwalk_rehash(w_src); + bm_uuidwalk_rehash(w_dst); + } + + if (found) { + GHashIterator gh_iter; + const unsigned int faces_result_len = (unsigned int)BLI_ghash_size(w_dst->faces_uuid); + unsigned int i; + + faces_result = MEM_mallocN(sizeof(faces_result) * (faces_result_len + 1), __func__); + GHASH_ITER_INDEX (gh_iter, w_dst->faces_uuid, i) { + BMFace *f = BLI_ghashIterator_getKey(&gh_iter); + faces_result[i] = f; + } + faces_result[faces_result_len] = NULL; + *r_faces_result_len = faces_result_len; + } + else { + *r_faces_result_len = 0; + } + +finally: + +#ifdef USE_WALKER_REUSE + bm_uuidwalk_clear(w_src); + bm_uuidwalk_clear(w_dst); +#else + bm_uuidwalk_free(w_src); + bm_uuidwalk_free(w_dst); +#endif + + return faces_result; +} + +/** + * Tag as visited, avoid re-use. + */ +static void bm_face_array_visit( + BMFace **faces, const unsigned int faces_len, + unsigned int *r_verts_len, + bool visit_faces) +{ + unsigned int verts_len = 0; + unsigned int i; + for (i = 0; i < faces_len; i++) { + BMFace *f = faces[i]; + BMLoop *l_iter, *l_first; + l_iter = l_first = BM_FACE_FIRST_LOOP(f); + do { + if (r_verts_len) { + if (!BM_elem_flag_test(l_iter->v, BM_ELEM_TAG)) { + verts_len += 1; + } + } + + BM_elem_flag_enable(l_iter->e, BM_ELEM_TAG); + BM_elem_flag_enable(l_iter->v, BM_ELEM_TAG); + } while ((l_iter = l_iter->next) != l_first); + + if (visit_faces) { + BM_elem_flag_enable(f, BM_ELEM_TAG); + } + } + + if (r_verts_len) { + *r_verts_len = verts_len; + } +} + +#ifdef USE_PIVOT_SEARCH + +/** \name Internal UUIDWalk API + * \{ */ + +/* signed user id */ +typedef intptr_t SUID_Int; + +static bool bm_edge_is_region_boundary(BMEdge *e) +{ + if (e->l->radial_next != e->l) { + BMLoop *l_iter = e->l; + do { + if (!BM_elem_flag_test(l_iter->f, BM_ELEM_TAG)) { + return true; + } + } while ((l_iter = l_iter->radial_next) != e->l); + return false; + } + else { + /* boundary */ + return true; + } +} + +static void bm_face_region_pivot_edge_use_best( + GHash *gh, BMEdge *e_test, + BMEdge **r_e_pivot_best, + SUID_Int e_pivot_best_id[2]) +{ + SUID_Int e_pivot_test_id[2]; + + e_pivot_test_id[0] = (SUID_Int)BLI_ghash_lookup(gh, e_test->v1); + e_pivot_test_id[1] = (SUID_Int)BLI_ghash_lookup(gh, e_test->v2); + if (e_pivot_test_id[0] > e_pivot_test_id[1]) { + SWAP(SUID_Int, e_pivot_test_id[0], e_pivot_test_id[1]); + } + + if ((*r_e_pivot_best == NULL) || + ((e_pivot_best_id[0] != e_pivot_test_id[0]) ? + (e_pivot_best_id[0] < e_pivot_test_id[0]) : + (e_pivot_best_id[1] < e_pivot_test_id[1]))) + { + e_pivot_best_id[0] = e_pivot_test_id[0]; + e_pivot_best_id[1] = e_pivot_test_id[1]; + + /* both verts are from the same pass, record this! */ + *r_e_pivot_best = e_test; + } +} + +/* quick id from a boundary vertex */ +static SUID_Int bm_face_region_vert_boundary_id(BMVert *v) +{ +#define PRIME_VERT_SMALL_A 7 +#define PRIME_VERT_SMALL_B 13 +#define PRIME_VERT_MID_A 103 +#define PRIME_VERT_MID_B 131 + + int tot = 0; + BMIter iter; + BMLoop *l; + SUID_Int id = PRIME_VERT_MID_A; + + BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) { + const bool is_boundary_vert = (bm_edge_is_region_boundary(l->e) || bm_edge_is_region_boundary(l->prev->e)); + id ^= l->f->len * (is_boundary_vert ? PRIME_VERT_SMALL_A : PRIME_VERT_SMALL_B); + tot += 1; + } + + id ^= (tot * PRIME_VERT_MID_B); + + return id ? ABS(id) : 1; + +#undef PRIME_VERT_SMALL_A +#undef PRIME_VERT_SMALL_B +#undef PRIME_VERT_MID_A +#undef PRIME_VERT_MID_B +} + +/** + * Accumulate id's from a previous pass (swap sign each pass) + */ +static SUID_Int bm_face_region_vert_pass_id(GHash *gh, BMVert *v) +{ + BMIter eiter; + BMEdge *e; + SUID_Int tot = 0; + SUID_Int v_sum_face_len = 0; + SUID_Int v_sum_id = 0; + SUID_Int id; + SUID_Int id_min = INTPTR_MIN + 1; + +#define PRIME_VERT_MID_A 23 +#define PRIME_VERT_MID_B 31 + + BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) { + if (BM_elem_flag_test(e, BM_ELEM_TAG)) { + BMVert *v_other = BM_edge_other_vert(e, v); + if (BM_elem_flag_test(v_other, BM_ELEM_TAG)) { + /* non-zero values aren't allowed... so no need to check haskey */ + SUID_Int v_other_id = (SUID_Int)BLI_ghash_lookup(gh, v_other); + if (v_other_id > 0) { + v_sum_id += v_other_id; + tot += 1; + + /* face-count */ + { + BMLoop *l_iter = e->l; + do { + if (BM_elem_flag_test(l_iter->f, BM_ELEM_TAG)) { + v_sum_face_len += l_iter->f->len; + } + } while ((l_iter = l_iter->radial_next) != e->l); + } + } + } + } + } + + id = (tot * PRIME_VERT_MID_A); + id ^= (v_sum_face_len * PRIME_VERT_MID_B); + id ^= v_sum_id; + + /* disallow 0 & min (since it can't be flipped) */ + id = (UNLIKELY(id == 0) ? 1 : UNLIKELY(id < id_min) ? id_min : id); + + return ABS(id); + +#undef PRIME_VERT_MID_A +#undef PRIME_VERT_MID_B +} + +/** + * Take a face region and find the inner-most vertex. + * also calculate the number of connections to the boundary, + * and the total number unique of verts used by this face region. + * + * This is only called once on the source region (no need to be highly optimized). + */ +static BMEdge *bm_face_region_pivot_edge_find( + BMFace **faces_region, unsigned int faces_region_len, + unsigned int verts_region_len, + unsigned int *r_depth) +{ + /* note, keep deterministic where possible (geometry order independent) + * this function assumed all visit faces & edges are tagged */ + + BLI_LINKSTACK_DECLARE(vert_queue_prev, BMVert *); + BLI_LINKSTACK_DECLARE(vert_queue_next, BMVert *); + + GHash *gh = BLI_ghash_ptr_new(__func__); + unsigned int i; + + BMEdge *e_pivot = NULL; + /* pick any non-boundary edge (not ideal) */ + BMEdge *e_pivot_fallback = NULL; + + SUID_Int pass = 0; + + /* total verts in 'gs' we have visited - aka - not v_init_none */ + unsigned int vert_queue_used = 0; + + BLI_LINKSTACK_INIT(vert_queue_prev); + BLI_LINKSTACK_INIT(vert_queue_next); + + /* face-verts */ + for (i = 0; i < faces_region_len; i++) { + BMFace *f = faces_region[i]; + + BMLoop *l_iter, *l_first; + l_iter = l_first = BM_FACE_FIRST_LOOP(f); + do { + BMEdge *e = l_iter->e; + if (bm_edge_is_region_boundary(e)) { + unsigned int j; + for (j = 0; j < 2; j++) { + if (!BLI_ghash_haskey(gh, (&e->v1)[j])) { + SUID_Int v_id = bm_face_region_vert_boundary_id((&e->v1)[j]); + BLI_ghash_insert(gh, (&e->v1)[j], (void *)v_id); + BLI_LINKSTACK_PUSH(vert_queue_prev, (&e->v1)[j]); + vert_queue_used += 1; + } + } + } + else { + /* use incase (depth == 0), no interior verts */ + e_pivot_fallback = e; + } + } while ((l_iter = l_iter->next) != l_first); + } + + while (BLI_LINKSTACK_SIZE(vert_queue_prev)) { + BMVert *v; + while ((v = BLI_LINKSTACK_POP(vert_queue_prev))) { + BMIter eiter; + BMEdge *e; + BLI_assert(BLI_ghash_haskey(gh, v)); + BLI_assert((SUID_Int)BLI_ghash_lookup(gh, v) > 0); + BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) { + if (BM_elem_flag_test(e, BM_ELEM_TAG)) { + BMVert *v_other = BM_edge_other_vert(e, v); + if (BM_elem_flag_test(v_other, BM_ELEM_TAG)) { + if (!BLI_ghash_haskey(gh, v_other)) { + /* add as negative, so we know not to read from them this pass */ + const SUID_Int v_id_other = -bm_face_region_vert_pass_id(gh, v_other); + BLI_ghash_insert(gh, v_other, (void *)v_id_other); + BLI_LINKSTACK_PUSH(vert_queue_next, v_other); + vert_queue_used += 1; + } + } + } + } + } + + /* flip all the newly added hashes to positive */ + { + LinkNode *v_link; + for (v_link = vert_queue_next; v_link; v_link = v_link->next) { + SUID_Int *v_id_p = (SUID_Int *)BLI_ghash_lookup_p(gh, v_link->link); + *v_id_p = -(*v_id_p); + BLI_assert(*v_id_p > 0); + } + } + + BLI_LINKSTACK_SWAP(vert_queue_prev, vert_queue_next); + pass += 1; + + if (vert_queue_used == verts_region_len) { + break; + } + } + + if (BLI_LINKSTACK_SIZE(vert_queue_prev) >= 2) { + /* common case - we managed to find some interior verts */ + LinkNode *v_link; + BMEdge *e_pivot_best = NULL; + SUID_Int e_pivot_best_id[2] = {0, 0}; + + /* temp untag, so we can quickly know what other verts are in this last pass */ + for (v_link = vert_queue_prev; v_link; v_link = v_link->next) { + BMVert *v = v_link->link; + BM_elem_flag_disable(v, BM_ELEM_TAG); + } + + /* restore correct tagging */ + for (v_link = vert_queue_prev; v_link; v_link = v_link->next) { + BMIter eiter; + BMEdge *e_test; + + BMVert *v = v_link->link; + BM_elem_flag_enable(v, BM_ELEM_TAG); + + BM_ITER_ELEM (e_test, &eiter, v, BM_EDGES_OF_VERT) { + if (BM_elem_flag_test(e_test, BM_ELEM_TAG)) { + BMVert *v_other = BM_edge_other_vert(e_test, v); + if (BM_elem_flag_test(v_other, BM_ELEM_TAG) == false) { + bm_face_region_pivot_edge_use_best(gh, e_test, &e_pivot_best, e_pivot_best_id); + } + } + } + } + + e_pivot = e_pivot_best; + } + + if ((e_pivot == NULL) && BLI_LINKSTACK_SIZE(vert_queue_prev)) { + /* find the best single edge */ + BMEdge *e_pivot_best = NULL; + SUID_Int e_pivot_best_id[2] = {0, 0}; + + LinkNode *v_link; + + /* reduce a pass since we're having to step into a previous passes vert, + * and will be closer to the boundary */ + BLI_assert(pass != 0); + pass -= 1; + + for (v_link = vert_queue_prev; v_link; v_link = v_link->next) { + BMVert *v = v_link->link; + + BMIter eiter; + BMEdge *e_test; + BM_ITER_ELEM (e_test, &eiter, v, BM_EDGES_OF_VERT) { + if (BM_elem_flag_test(e_test, BM_ELEM_TAG)) { + BMVert *v_other = BM_edge_other_vert(e_test, v); + if (BM_elem_flag_test(v_other, BM_ELEM_TAG)) { + bm_face_region_pivot_edge_use_best(gh, e_test, &e_pivot_best, e_pivot_best_id); + } + } + } + } + + e_pivot = e_pivot_best; + } + + BLI_LINKSTACK_FREE(vert_queue_prev); + BLI_LINKSTACK_FREE(vert_queue_next); + + BLI_ghash_free(gh, NULL, NULL); + + if (e_pivot == NULL) { +#ifdef DEBUG_PRINT + printf("%s: using fallback edge!\n", __func__); +#endif + e_pivot = e_pivot_fallback; + pass = 0; + } + + *r_depth = (unsigned int)pass; + + return e_pivot; +} +/** \} */ + +#endif /* USE_PIVOT_SEARCH */ + + +/* -------------------------------------------------------------------- */ +/* Quick UUID pass - identify candidates */ + +#ifdef USE_PIVOT_FASTMATCH + +/** \name Fast Match + * \{ */ + +typedef uintptr_t UUIDFashMatch; + +static UUIDFashMatch bm_vert_fasthash_single(BMVert *v) +{ + BMIter eiter; + BMEdge *e; + UUIDFashMatch e_num = 0, f_num = 0, l_num = 0; + +#define PRIME_EDGE 7 +#define PRIME_FACE 31 +#define PRIME_LOOP 61 + + BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) { + if (!BM_edge_is_wire(e)) { + BMLoop *l_iter = e->l; + e_num += 1; + do { + f_num += 1; + l_num += (unsigned int)l_iter->f->len; + } while ((l_iter = l_iter->radial_next) != e->l); + } + } + + return ((e_num * PRIME_EDGE) ^ + (f_num * PRIME_FACE) * + (l_num * PRIME_LOOP)); + +#undef PRIME_EDGE +#undef PRIME_FACE +#undef PRIME_LOOP +} + +static UUIDFashMatch *bm_vert_fasthash_create( + BMesh *bm, const unsigned int depth) +{ + UUIDFashMatch *id_prev; + UUIDFashMatch *id_curr; + unsigned int pass, i; + BMVert *v; + BMIter iter; + + id_prev = MEM_mallocN(sizeof(*id_prev) * (unsigned int)bm->totvert, __func__); + id_curr = MEM_mallocN(sizeof(*id_curr) * (unsigned int)bm->totvert, __func__); + + BM_ITER_MESH_INDEX (v, &iter, bm, BM_VERTS_OF_MESH, i) { + id_prev[i] = bm_vert_fasthash_single(v); + } + + for (pass = 0; pass < depth; pass++) { + BMEdge *e; + + memcpy(id_curr, id_prev, sizeof(*id_prev) * (unsigned int)bm->totvert); + + BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { + if (BM_edge_is_wire(e) == false) { + const int i1 = BM_elem_index_get(e->v1); + const int i2 = BM_elem_index_get(e->v2); + + id_curr[i1] += id_prev[i2]; + id_curr[i2] += id_prev[i1]; + } + } + } + MEM_freeN(id_prev); + + return id_curr; +} + +static void bm_vert_fasthash_edge_order( + UUIDFashMatch *fm, const BMEdge *e, UUIDFashMatch e_fm[2]) +{ + e_fm[0] = fm[BM_elem_index_get(e->v1)]; + e_fm[1] = fm[BM_elem_index_get(e->v2)]; + + if (e_fm[0] > e_fm[1]) { + SWAP(UUIDFashMatch, e_fm[0], e_fm[1]); + } +} + +static bool bm_vert_fasthash_edge_is_match( + UUIDFashMatch *fm, const BMEdge *e_a, const BMEdge *e_b) +{ + UUIDFashMatch e_a_fm[2]; + UUIDFashMatch e_b_fm[2]; + + bm_vert_fasthash_edge_order(fm, e_a, e_a_fm); + bm_vert_fasthash_edge_order(fm, e_b, e_b_fm); + + return ((e_a_fm[0] == e_b_fm[0]) && + (e_a_fm[1] == e_b_fm[1])); +} + +static void bm_vert_fasthash_destroy( + UUIDFashMatch *fm) +{ + MEM_freeN(fm); +} + +/** \} */ + +#endif /* USE_PIVOT_FASTMATCH */ + + +/** + * Take a face-region and return a list of matching face-regions. + * + * \param faces_region A single, contiguous face-region. + * \return A list of matching null-terminated face-region arrays. + */ +int BM_mesh_region_match( + BMesh *bm, + BMFace **faces_region, unsigned int faces_region_len, + ListBase *r_face_regions) +{ + BMEdge *e_src; + BMEdge *e_dst; + BMIter iter; + unsigned int verts_region_len = 0; + unsigned int faces_result_len = 0; + /* number of steps from e_src to a boundary vert */ + unsigned int depth; + + +#ifdef USE_WALKER_REUSE + UUIDWalk w_src, w_dst; +#endif + +#ifdef USE_PIVOT_FASTMATCH + UUIDFashMatch *fm; +#endif + +#ifdef DEBUG_PRINT + int search_num = 0; +#endif + +#ifdef DEBUG_TIME + TIMEIT_START(region_match); +#endif + + /* initialize visited verts */ + BM_mesh_elem_hflag_disable_all(bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_TAG, false); + bm_face_array_visit(faces_region, faces_region_len, &verts_region_len, true); + + /* needed for 'ghashutil_bmelem_indexhash' */ + BM_mesh_elem_index_ensure(bm, BM_VERT | BM_FACE); + +#ifdef USE_PIVOT_SEARCH + e_src = bm_face_region_pivot_edge_find( + faces_region, faces_region_len, + verts_region_len, &depth); + + /* see which edge is added */ +#if 0 + BM_select_history_clear(bm); + if (e_src) { + BM_select_history_store(bm, e_src); + } +#endif + +#else + /* quick test only! */ + e_src = BM_mesh_active_edge_get(bm); +#endif + + if (e_src == NULL) { +#ifdef DEBUG_PRINT + printf("Couldn't find 'e_src'"); +#endif + return 0; + } + + BLI_listbase_clear(r_face_regions); + +#ifdef USE_PIVOT_FASTMATCH + if (depth > 0) { + fm = bm_vert_fasthash_create(bm, depth); + } + else { + fm = NULL; + } +#endif + +#ifdef USE_WALKER_REUSE + bm_uuidwalk_init(&w_src, faces_region_len, verts_region_len); + bm_uuidwalk_init(&w_dst, faces_region_len, verts_region_len); +#endif + + BM_ITER_MESH (e_dst, &iter, bm, BM_EDGES_OF_MESH) { + BMFace **faces_result; + unsigned int faces_result_len_out; + + if (BM_elem_flag_test(e_dst, BM_ELEM_TAG)) { + continue; + } + +#ifdef USE_PIVOT_FASTMATCH + if (fm && !bm_vert_fasthash_edge_is_match(fm, e_src, e_dst)) { + continue; + } +#endif + +#ifdef DEBUG_PRINT + search_num += 1; +#endif + + faces_result = bm_mesh_region_match_pair( +#ifdef USE_WALKER_REUSE + &w_src, &w_dst, +#endif + e_src, e_dst, + faces_region_len, + verts_region_len, + &faces_result_len_out); + + /* tag verts as visited */ + if (faces_result) { + LinkData *link; + + bm_face_array_visit(faces_result, faces_result_len_out, NULL, false); + + link = BLI_genericNodeN(faces_result); + BLI_addtail(r_face_regions, link); + faces_result_len += 1; + } + } + +#ifdef USE_WALKER_REUSE + bm_uuidwalk_free(&w_src); + bm_uuidwalk_free(&w_dst); +#else + (void)bm_uuidwalk_clear; +#endif + +#ifdef USE_PIVOT_FASTMATCH + if (fm) { + bm_vert_fasthash_destroy(fm); + } +#endif + +#ifdef DEBUG_PRINT + printf("%s: search: %d, found %d\n", __func__, search_num, faces_result_len); +#endif + +#ifdef DEBUG_TIME + TIMEIT_END(region_match); +#endif + + return (int)faces_result_len; +} diff --git a/source/blender/bmesh/tools/bmesh_region_match.h b/source/blender/bmesh/tools/bmesh_region_match.h new file mode 100644 index 00000000000..edf8369b070 --- /dev/null +++ b/source/blender/bmesh/tools/bmesh_region_match.h @@ -0,0 +1,33 @@ +/* + * ***** 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. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef __BMESH_REGION_MATCH_H__ +#define __BMESH_REGION_MATCH_H__ + +/** \file blender/bmesh/tools/bmesh_region_match.h + * \ingroup bmesh + */ + +int BM_mesh_region_match( + BMesh *bm, + BMFace **faces_region, unsigned int faces_region_len, + ListBase *r_face_regions); + +#endif /* __BMESH_REGION_MATCH_H__ */ diff --git a/source/blender/collada/collada.cpp b/source/blender/collada/collada.cpp index 223ab3eca2a..ffbbb8623ac 100644 --- a/source/blender/collada/collada.cpp +++ b/source/blender/collada/collada.cpp @@ -111,16 +111,28 @@ int collada_export(Scene *sce, eObjectSet objectSet = (export_settings.selected) ? OB_SET_SELECTED : OB_SET_ALL; export_settings.export_set = BKE_object_relational_superset(sce, objectSet, (eObRelationTypes)includeFilter); - - if (export_settings.sort_by_name) - bc_bubble_sort_by_Object_name(export_settings.export_set); + int export_count = BLI_linklist_length(export_settings.export_set); + + if (export_count==0) + { + if (export_settings.selected) { + fprintf(stderr, "Collada: Found no objects to export.\nPlease ensure that all objects which shall be exported are also visible in the 3D Viewport.\n"); + } + else{ + fprintf(stderr, "Collada: Your scene seems to be empty. No Objects will be exported.\n"); + } + } + else { + if (export_settings.sort_by_name) + bc_bubble_sort_by_Object_name(export_settings.export_set); + } DocumentExporter exporter(&export_settings); exporter.exportCurrentScene(sce); BLI_linklist_free(export_settings.export_set, NULL); - return 1; + return export_count; } /* end extern C */ diff --git a/source/blender/compositor/nodes/COM_BlurNode.cpp b/source/blender/compositor/nodes/COM_BlurNode.cpp index 76e52c14685..f3d0c33d3b3 100644 --- a/source/blender/compositor/nodes/COM_BlurNode.cpp +++ b/source/blender/compositor/nodes/COM_BlurNode.cpp @@ -105,6 +105,7 @@ void BlurNode::convertToOperations(NodeConverter &converter, const CompositorCon GaussianXBlurOperation *operationx = new GaussianXBlurOperation(); operationx->setData(data); operationx->setQuality(quality); + operationx->checkOpenCL(); converter.addOperation(operationx); converter.mapInputSocket(getInputSocket(1), operationx->getInputSocket(1)); @@ -112,6 +113,7 @@ void BlurNode::convertToOperations(NodeConverter &converter, const CompositorCon GaussianYBlurOperation *operationy = new GaussianYBlurOperation(); operationy->setData(data); operationy->setQuality(quality); + operationy->checkOpenCL(); converter.addOperation(operationy); converter.mapInputSocket(getInputSocket(1), operationy->getInputSocket(1)); diff --git a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp index 0aefba3bb7c..0838d281de7 100644 --- a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp @@ -21,6 +21,7 @@ */ #include "COM_GaussianXBlurOperation.h" +#include "COM_OpenCLDevice.h" #include "BLI_math.h" #include "MEM_guardedalloc.h" @@ -124,6 +125,32 @@ void GaussianXBlurOperation::executePixel(float output[4], int x, int y, void *d mul_v4_v4fl(output, color_accum, 1.0f / multiplier_accum); } +void GaussianXBlurOperation::executeOpenCL(OpenCLDevice *device, + MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, + MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, + list<cl_kernel> *clKernelsToCleanUp) +{ + cl_kernel gaussianXBlurOperationKernel = device->COM_clCreateKernel("gaussianXBlurOperationKernel", NULL); + cl_int filter_size = this->m_filtersize; + + cl_mem gausstab = clCreateBuffer(device->getContext(), + CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR, + sizeof(float) * (this->m_filtersize * 2 + 1), + this->m_gausstab, + NULL); + + device->COM_clAttachMemoryBufferToKernelParameter(gaussianXBlurOperationKernel, 0, 1, clMemToCleanUp, inputMemoryBuffers, this->m_inputProgram); + device->COM_clAttachOutputMemoryBufferToKernelParameter(gaussianXBlurOperationKernel, 2, clOutputBuffer); + device->COM_clAttachMemoryBufferOffsetToKernelParameter(gaussianXBlurOperationKernel, 3, outputMemoryBuffer); + clSetKernelArg(gaussianXBlurOperationKernel, 4, sizeof(cl_int), &filter_size); + device->COM_clAttachSizeToKernelParameter(gaussianXBlurOperationKernel, 5, this); + clSetKernelArg(gaussianXBlurOperationKernel, 6, sizeof(cl_mem), &gausstab); + + device->COM_clEnqueueRange(gaussianXBlurOperationKernel, outputMemoryBuffer, 7, this); + + clReleaseMemObject(gausstab); +} + void GaussianXBlurOperation::deinitExecution() { BlurBaseOperation::deinitExecution(); diff --git a/source/blender/compositor/operations/COM_GaussianXBlurOperation.h b/source/blender/compositor/operations/COM_GaussianXBlurOperation.h index e391320a007..d7ae8b1e3dc 100644 --- a/source/blender/compositor/operations/COM_GaussianXBlurOperation.h +++ b/source/blender/compositor/operations/COM_GaussianXBlurOperation.h @@ -40,7 +40,12 @@ public: * @brief the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + + void executeOpenCL(OpenCLDevice *device, + MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, + MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, + list<cl_kernel> *clKernelsToCleanUp); + /** * @brief initialize the execution */ @@ -53,5 +58,9 @@ public: void *initializeTileData(rcti *rect); bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); + + void checkOpenCL() { + this->setOpenCL(m_data.sizex >= 128); + } }; #endif diff --git a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp index a05a1ab6a23..6172f954087 100644 --- a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp @@ -21,6 +21,7 @@ */ #include "COM_GaussianYBlurOperation.h" +#include "COM_OpenCLDevice.h" #include "BLI_math.h" #include "MEM_guardedalloc.h" @@ -126,6 +127,32 @@ void GaussianYBlurOperation::executePixel(float output[4], int x, int y, void *d mul_v4_v4fl(output, color_accum, 1.0f / multiplier_accum); } +void GaussianYBlurOperation::executeOpenCL(OpenCLDevice *device, + MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, + MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, + list<cl_kernel> *clKernelsToCleanUp) +{ + cl_kernel gaussianYBlurOperationKernel = device->COM_clCreateKernel("gaussianYBlurOperationKernel", NULL); + cl_int filter_size = this->m_filtersize; + + cl_mem gausstab = clCreateBuffer(device->getContext(), + CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR, + sizeof(float) * (this->m_filtersize * 2 + 1), + this->m_gausstab, + NULL); + + device->COM_clAttachMemoryBufferToKernelParameter(gaussianYBlurOperationKernel, 0, 1, clMemToCleanUp, inputMemoryBuffers, this->m_inputProgram); + device->COM_clAttachOutputMemoryBufferToKernelParameter(gaussianYBlurOperationKernel, 2, clOutputBuffer); + device->COM_clAttachMemoryBufferOffsetToKernelParameter(gaussianYBlurOperationKernel, 3, outputMemoryBuffer); + clSetKernelArg(gaussianYBlurOperationKernel, 4, sizeof(cl_int), &filter_size); + device->COM_clAttachSizeToKernelParameter(gaussianYBlurOperationKernel, 5, this); + clSetKernelArg(gaussianYBlurOperationKernel, 6, sizeof(cl_mem), &gausstab); + + device->COM_clEnqueueRange(gaussianYBlurOperationKernel, outputMemoryBuffer, 7, this); + + clReleaseMemObject(gausstab); +} + void GaussianYBlurOperation::deinitExecution() { BlurBaseOperation::deinitExecution(); diff --git a/source/blender/compositor/operations/COM_GaussianYBlurOperation.h b/source/blender/compositor/operations/COM_GaussianYBlurOperation.h index 22b6562077d..4b5751c0968 100644 --- a/source/blender/compositor/operations/COM_GaussianYBlurOperation.h +++ b/source/blender/compositor/operations/COM_GaussianYBlurOperation.h @@ -40,7 +40,12 @@ public: * the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + + void executeOpenCL(OpenCLDevice *device, + MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, + MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, + list<cl_kernel> *clKernelsToCleanUp); + /** * @brief initialize the execution */ @@ -53,5 +58,9 @@ public: void *initializeTileData(rcti *rect); bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); + + void checkOpenCL() { + this->setOpenCL(m_data.sizex >= 128); + } }; #endif diff --git a/source/blender/compositor/operations/COM_KeyingBlurOperation.cpp b/source/blender/compositor/operations/COM_KeyingBlurOperation.cpp index 9fb9efe4fc7..ddc09ecb483 100644 --- a/source/blender/compositor/operations/COM_KeyingBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_KeyingBlurOperation.cpp @@ -49,37 +49,27 @@ void *KeyingBlurOperation::initializeTileData(rcti *rect) void KeyingBlurOperation::executePixel(float output[4], int x, int y, void *data) { MemoryBuffer *inputBuffer = (MemoryBuffer *)data; + const int bufferWidth = inputBuffer->getWidth(); float *buffer = inputBuffer->getBuffer(); - - int bufferWidth = inputBuffer->getWidth(); - int bufferHeight = inputBuffer->getHeight(); - - int i, count = 0; - + int count = 0; float average = 0.0f; if (this->m_axis == 0) { - for (i = -this->m_size + 1; i < this->m_size; i++) { - int cx = x + i; - - if (cx >= 0 && cx < bufferWidth) { - int bufferIndex = (y * bufferWidth + cx) * 4; - - average += buffer[bufferIndex]; - count++; - } + const int start = max(0, x - this->m_size + 1), + end = min(bufferWidth, x + this->m_size); + for (int cx = start; cx < end; ++cx) { + int bufferIndex = (y * bufferWidth + cx) * 4; + average += buffer[bufferIndex]; + count++; } } else { - for (i = -this->m_size + 1; i < this->m_size; i++) { - int cy = y + i; - - if (cy >= 0 && cy < bufferHeight) { - int bufferIndex = (cy * bufferWidth + x) * 4; - - average += buffer[bufferIndex]; - count++; - } + const int start = max(0, y - this->m_size + 1), + end = min(inputBuffer->getHeight(), y + this->m_size); + for (int cy = start; cy < end; ++cy) { + int bufferIndex = (cy * bufferWidth + x) * 4; + average += buffer[bufferIndex]; + count++; } } diff --git a/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp b/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp index 17b85847fcf..1633d2a2f1d 100644 --- a/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp +++ b/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp @@ -188,9 +188,9 @@ KeyingScreenOperation::TriangulationData *KeyingScreenOperation::buildVoronoiTri BLI_freelistN(&edges); if (triangulation->triangles_total) { - rctf *rect; + rcti *rect; rect = triangulation->triangles_AABB = - (rctf *) MEM_callocN(sizeof(rctf) * triangulation->triangles_total, "voronoi triangulation AABB"); + (rcti *) MEM_callocN(sizeof(rcti) * triangulation->triangles_total, "voronoi triangulation AABB"); for (i = 0; i < triangulation->triangles_total; i++, rect++) { int *triangle = triangulation->triangles[i]; @@ -206,11 +206,11 @@ KeyingScreenOperation::TriangulationData *KeyingScreenOperation::buildVoronoiTri minmax_v2v2_v2(min, max, b->co); minmax_v2v2_v2(min, max, c->co); - rect->xmin = min[0]; - rect->ymin = min[1]; + rect->xmin = (int)min[0]; + rect->ymin = (int)min[1]; - rect->xmax = max[0]; - rect->ymax = max[1]; + rect->xmax = (int)max[0] + 1; + rect->ymax = (int)max[1] + 1; } } @@ -224,7 +224,6 @@ void *KeyingScreenOperation::initializeTileData(rcti *rect) int triangles_allocated = 0; int chunk_size = 20; int i; - rctf rect_float; if (this->m_movieClip == NULL) return NULL; @@ -242,14 +241,10 @@ void *KeyingScreenOperation::initializeTileData(rcti *rect) if (!triangulation) return NULL; - BLI_rctf_init(&rect_float, rect->xmin, rect->xmax, rect->ymin, rect->ymax); - tile_data = (TileData *) MEM_callocN(sizeof(TileData), "keying screen tile data"); for (i = 0; i < triangulation->triangles_total; i++) { - bool ok = BLI_rctf_isect(&rect_float, &triangulation->triangles_AABB[i], NULL); - - if (ok) { + if (BLI_rcti_isect(rect, &triangulation->triangles_AABB[i], NULL)) { tile_data->triangles_total++; if (tile_data->triangles_total > triangles_allocated) { @@ -316,7 +311,7 @@ void KeyingScreenOperation::executePixel(float output[4], int x, int y, void *da for (i = 0; i < tile_data->triangles_total; i++) { int triangle_idx = tile_data->triangles[i]; - rctf *rect = &triangulation->triangles_AABB[triangle_idx]; + rcti *rect = &triangulation->triangles_AABB[triangle_idx]; if (IN_RANGE_INCL(x, rect->xmin, rect->xmax) && IN_RANGE_INCL(y, rect->ymin, rect->ymax)) { int *triangle = triangulation->triangles[triangle_idx]; diff --git a/source/blender/compositor/operations/COM_KeyingScreenOperation.h b/source/blender/compositor/operations/COM_KeyingScreenOperation.h index 10cf48e57f4..b1a5c0c39c7 100644 --- a/source/blender/compositor/operations/COM_KeyingScreenOperation.h +++ b/source/blender/compositor/operations/COM_KeyingScreenOperation.h @@ -47,7 +47,7 @@ protected: VoronoiTriangulationPoint *triangulated_points; int (*triangles)[3]; int triangulated_points_total, triangles_total; - rctf *triangles_AABB; + rcti *triangles_AABB; } TriangulationData; typedef struct TileData { diff --git a/source/blender/compositor/operations/COM_MapUVOperation.cpp b/source/blender/compositor/operations/COM_MapUVOperation.cpp index 87ad1d6afa4..6bf730253e7 100644 --- a/source/blender/compositor/operations/COM_MapUVOperation.cpp +++ b/source/blender/compositor/operations/COM_MapUVOperation.cpp @@ -62,7 +62,7 @@ void MapUVOperation::executePixelSampled(float output[4], float x, float y, Pixe */ float du = len_v2(deriv[0]); float dv = len_v2(deriv[1]); - float factor = 1.0f - threshold * (du + dv); + float factor = 1.0f - threshold * (du / m_inputColorProgram->getWidth() + dv / m_inputColorProgram->getHeight()); if (factor < 0.f) alpha = 0.f; else alpha *= factor; diff --git a/source/blender/compositor/operations/COM_MixOperation.h b/source/blender/compositor/operations/COM_MixOperation.h index 479ce161eea..d399edba6e9 100644 --- a/source/blender/compositor/operations/COM_MixOperation.h +++ b/source/blender/compositor/operations/COM_MixOperation.h @@ -76,7 +76,7 @@ public: void setUseValueAlphaMultiply(const bool value) { this->m_valueAlphaMultiply = value; } - bool useValueAlphaMultiply() { return this->m_valueAlphaMultiply; } + inline bool useValueAlphaMultiply() { return this->m_valueAlphaMultiply; } void setUseClamp(bool value) { this->m_useClamp = value; } }; diff --git a/source/blender/compositor/operations/COM_OpenCLKernels.cl b/source/blender/compositor/operations/COM_OpenCLKernels.cl index 00b3825d8b3..1b965eb8659 100644 --- a/source/blender/compositor/operations/COM_OpenCLKernels.cl +++ b/source/blender/compositor/operations/COM_OpenCLKernels.cl @@ -250,3 +250,66 @@ __kernel void directionalBlurKernel(__read_only image2d_t inputImage, __write_o write_imagef(output, coords, col); } + +// KERNEL --- GAUSSIAN BLUR --- +__kernel void gaussianXBlurOperationKernel(__read_only image2d_t inputImage, + int2 offsetInput, + __write_only image2d_t output, + int2 offsetOutput, + int filter_size, + int2 dimension, + __global float *gausstab, + int2 offset) +{ + float4 color = {0.0f, 0.0f, 0.0f, 0.0f}; + int2 coords = {get_global_id(0), get_global_id(1)}; + coords += offset; + const int2 realCoordinate = coords + offsetOutput; + int2 inputCoordinate = realCoordinate - offsetInput; + float weight = 0.0f; + + int xmin = max(realCoordinate.x - filter_size, 0) - offsetInput.x; + int xmax = min(realCoordinate.x + filter_size + 1, dimension.x) - offsetInput.x; + + for (int nx = xmin, i = max(filter_size - realCoordinate.x, 0); nx < xmax; ++nx, ++i) { + float w = gausstab[i]; + inputCoordinate.x = nx; + color += read_imagef(inputImage, SAMPLER_NEAREST, inputCoordinate) * w; + weight += w; + } + + color *= (1.0f / weight); + + write_imagef(output, coords, color); +} + +__kernel void gaussianYBlurOperationKernel(__read_only image2d_t inputImage, + int2 offsetInput, + __write_only image2d_t output, + int2 offsetOutput, + int filter_size, + int2 dimension, + __global float *gausstab, + int2 offset) +{ + float4 color = {0.0f, 0.0f, 0.0f, 0.0f}; + int2 coords = {get_global_id(0), get_global_id(1)}; + coords += offset; + const int2 realCoordinate = coords + offsetOutput; + int2 inputCoordinate = realCoordinate - offsetInput; + float weight = 0.0f; + + int ymin = max(realCoordinate.y - filter_size, 0) - offsetInput.y; + int ymax = min(realCoordinate.y + filter_size + 1, dimension.y) - offsetInput.y; + + for (int ny = ymin, i = max(filter_size - realCoordinate.y, 0); ny < ymax; ++ny, ++i) { + float w = gausstab[i]; + inputCoordinate.y = ny; + color += read_imagef(inputImage, SAMPLER_NEAREST, inputCoordinate) * w; + weight += w; + } + + color *= (1.0f / weight); + + write_imagef(output, coords, color); +} diff --git a/source/blender/compositor/operations/COM_SunBeamsOperation.cpp b/source/blender/compositor/operations/COM_SunBeamsOperation.cpp index 9a34dccacb1..bcef652a8b5 100644 --- a/source/blender/compositor/operations/COM_SunBeamsOperation.cpp +++ b/source/blender/compositor/operations/COM_SunBeamsOperation.cpp @@ -138,22 +138,35 @@ struct BufferLineAccumulator { int x, y, num; float v, dv; float falloff_factor; + float border[4]; + + if ((int)pt_ofs[0] == 0 && (int)pt_ofs[1] == 0) { + copy_v4_v4(output, input->getBuffer() + COM_NUMBER_OF_CHANNELS * ((int)source[0] + input->getWidth() * (int)source[1])); + return; + } /* initialise the iteration variables */ float *buffer = init_buffer_iterator(input, source, pt_ofs, dist_min, dist_max, x, y, num, v, dv, falloff_factor); - - int tot = 0; + zero_v3(border); + border[3] = 1.0f; /* v_local keeps track of when to decrement v (see below) */ float v_local = v - floorf(v); for (int i = 0; i < num; i++) { - /* range check, abort when running beyond the image border */ - if (x < rect.xmin || x >= rect.xmax || y < rect.ymin || y >= rect.ymax) - break; - - float f = 1.0f - (float)i * falloff_factor; - madd_v4_v4fl(output, buffer, buffer[3] * f * f); + float weight = 1.0f - (float)i * falloff_factor; + weight *= weight; + + /* range check, use last valid color when running beyond the image border */ + if (x >= rect.xmin && x < rect.xmax && y >= rect.ymin && y < rect.ymax) { + madd_v4_v4fl(output, buffer, buffer[3] * weight); + /* use as border color in case subsequent pixels are out of bounds */ + copy_v4_v4(border, buffer); + } + else { + madd_v4_v4fl(output, border, border[3] * weight); + } + /* TODO implement proper filtering here, see * http://en.wikipedia.org/wiki/Lanczos_resampling * http://en.wikipedia.org/wiki/Sinc_function @@ -161,9 +174,8 @@ struct BufferLineAccumulator { * using lanczos with x = distance from the line segment, * normalized to a == 0.5f, could give a good result * - * for now just count samples and divide equally at the end ... + * for now just divide equally at the end ... */ - tot++; /* decrement u */ x -= fxx; diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c index 481912f4d1f..296a52e7f20 100644 --- a/source/blender/editors/animation/drivers.c +++ b/source/blender/editors/animation/drivers.c @@ -426,74 +426,6 @@ bool ANIM_paste_driver(ReportList *reports, ID *id, const char rna_path[], int a /* ************************************************** */ /* UI-Button Interface */ -/** - * Temporary wrapper for driver operators for buttons to make it easier to create - * such drivers by rerouting all paths through the active object instead so that - * they will get picked up by the dependency system. - * - * \param C Context pointer - for getting active data - * \param[in,out] ptr RNA pointer for property's datablock. May be modified as result of path remapping. - * \param prop RNA definition of property to add for - * \return MEM_alloc'd string representing the path to the property from the given #PointerRNA - */ -static char *get_driver_path_hack(bContext *C, PointerRNA *ptr, PropertyRNA *prop) -{ - ID *id = (ID *)ptr->id.data; - ScrArea *sa = CTX_wm_area(C); - - /* get standard path which may be extended */ - char *basepath = RNA_path_from_ID_to_property(ptr, prop); - char *path = basepath; /* in case no remapping is needed */ - - - /* Remapping will only be performed in the Properties Editor, as only this - * restricts the subspace of options to the 'active' data (a manageable state) - */ - // TODO: watch out for pinned context? - if ((sa) && (sa->spacetype == SPACE_BUTS)) { - Object *ob = CTX_data_active_object(C); - - if (ob && id) { - /* only id-types which can be remapped to go through objects should be considered */ - switch (GS(id->name)) { - case ID_TE: /* textures */ - { - Material *ma = give_current_material(ob, ob->actcol); - Tex *tex = give_current_material_texture(ma); - - /* assumes: texture will only be shown if it is active material's active texture it's ok */ - if ((ID *)tex == id) { - char name_esc_ma[(sizeof(ma->id.name) - 2) * 2]; - char name_esc_tex[(sizeof(tex->id.name) - 2) * 2]; - - BLI_strescape(name_esc_ma, ma->id.name + 2, sizeof(name_esc_ma)); - BLI_strescape(name_esc_tex, tex->id.name + 2, sizeof(name_esc_tex)); - - /* create new path */ - // TODO: use RNA path functions to construct step by step instead? - // FIXME: maybe this isn't even needed anymore... - path = BLI_sprintfN("material_slots[\"%s\"].material.texture_slots[\"%s\"].texture.%s", - name_esc_ma, name_esc_tex, basepath); - - /* free old one */ - MEM_freeN(basepath); - } - break; - } - } - - /* fix RNA pointer, as we've now changed the ID root by changing the paths */ - if (basepath != path) { - /* rebase provided pointer so that it starts from object... */ - RNA_pointer_create(&ob->id, ptr->type, ptr->data, ptr); - } - } - } - - /* the path should now have been corrected for use */ - return path; -} - /* Add Driver Button Operator ------------------------ */ static int add_driver_button_exec(bContext *C, wmOperator *op) @@ -511,7 +443,7 @@ static int add_driver_button_exec(bContext *C, wmOperator *op) index = -1; if (ptr.id.data && ptr.data && prop && RNA_property_animateable(&ptr, prop)) { - char *path = get_driver_path_hack(C, &ptr, prop); + char *path = BKE_animdata_driver_path_hack(C, &ptr, prop, NULL); short flags = CREATEDRIVER_WITH_DEFAULT_DVAR; if (path) { @@ -566,7 +498,7 @@ static int remove_driver_button_exec(bContext *C, wmOperator *op) index = -1; if (ptr.id.data && ptr.data && prop) { - char *path = get_driver_path_hack(C, &ptr, prop); + char *path = BKE_animdata_driver_path_hack(C, &ptr, prop, NULL); success = ANIM_remove_driver(op->reports, ptr.id.data, path, index, 0); MEM_freeN(path); @@ -613,7 +545,7 @@ static int copy_driver_button_exec(bContext *C, wmOperator *op) uiContextActiveProperty(C, &ptr, &prop, &index); if (ptr.id.data && ptr.data && prop && RNA_property_animateable(&ptr, prop)) { - char *path = get_driver_path_hack(C, &ptr, prop); + char *path = BKE_animdata_driver_path_hack(C, &ptr, prop, NULL); if (path) { /* only copy the driver for the button that this was involved for */ @@ -657,7 +589,7 @@ static int paste_driver_button_exec(bContext *C, wmOperator *op) uiContextActiveProperty(C, &ptr, &prop, &index); if (ptr.id.data && ptr.data && prop && RNA_property_animateable(&ptr, prop)) { - char *path = get_driver_path_hack(C, &ptr, prop); + char *path = BKE_animdata_driver_path_hack(C, &ptr, prop, NULL); if (path) { /* only copy the driver for the button that this was involved for */ diff --git a/source/blender/editors/armature/armature_edit.c b/source/blender/editors/armature/armature_edit.c index 1e4d9bac246..b7ab7fe064d 100644 --- a/source/blender/editors/armature/armature_edit.c +++ b/source/blender/editors/armature/armature_edit.c @@ -70,7 +70,7 @@ void ED_armature_apply_transform(Object *ob, float mat[4][4]) /* Put the armature into editmode */ ED_armature_to_edit(arm); - /* Transform the bones*/ + /* Transform the bones */ ED_armature_transform_bones(arm, mat); /* Turn the list into an armature */ @@ -100,7 +100,7 @@ void ED_armature_transform_bones(struct bArmature *arm, float mat[4][4]) mul_m4_v3(mat, ebone->head); mul_m4_v3(mat, ebone->tail); - /* apply the transfiormed roll back */ + /* apply the transformed roll back */ mat3_to_vec_roll(tmat, NULL, &ebone->roll); ebone->rad_head *= scale; @@ -190,7 +190,7 @@ void ED_armature_origin_set(Scene *scene, Object *ob, float cursor[3], int cente /* Adjust object location for new centerpoint */ if (centermode && obedit == NULL) { - mul_mat3_m4_v3(ob->obmat, cent); /* ommit translation part */ + mul_mat3_m4_v3(ob->obmat, cent); /* omit translation part */ add_v3_v3(ob->loc, cent); } } diff --git a/source/blender/editors/armature/armature_intern.h b/source/blender/editors/armature/armature_intern.h index 1d054ffc2e9..6d616384b9a 100644 --- a/source/blender/editors/armature/armature_intern.h +++ b/source/blender/editors/armature/armature_intern.h @@ -237,7 +237,7 @@ void armature_select_mirrored(struct bArmature *arm); void armature_tag_unselect(struct bArmature *arm); void *get_nearest_bone(struct bContext *C, short findunsel, int x, int y); -void *get_bone_from_selectbuffer(struct Scene *scene, struct Base *base, unsigned int *buffer, short hits, short findunsel); +void *get_bone_from_selectbuffer(struct Scene *scene, struct Base *base, unsigned int *buffer, short hits, short findunsel, bool do_nearest); int bone_looper(struct Object *ob, struct Bone *bone, void *data, int (*bone_func)(struct Object *, struct Bone *, void *)); diff --git a/source/blender/editors/armature/armature_relations.c b/source/blender/editors/armature/armature_relations.c index e4ba8728e55..75fa4a5433f 100644 --- a/source/blender/editors/armature/armature_relations.c +++ b/source/blender/editors/armature/armature_relations.c @@ -245,7 +245,7 @@ int join_armature_exec(bContext *C, wmOperator *op) invert_m4_m4(imat, premat); mul_m4_m4m4(difmat, imat, postmat); - curbone->roll -= (float)atan2(difmat[2][0], difmat[2][2]); + curbone->roll -= atan2f(difmat[2][0], difmat[2][2]); } /* Fix Constraints and Other Links to this Bone and Armature */ diff --git a/source/blender/editors/armature/armature_select.c b/source/blender/editors/armature/armature_select.c index 12d13b05ee1..c6ef76c570c 100644 --- a/source/blender/editors/armature/armature_select.c +++ b/source/blender/editors/armature/armature_select.c @@ -73,7 +73,7 @@ Bone *get_indexed_bone(Object *ob, int index) /* See if there are any selected bones in this buffer */ /* only bones from base are checked on */ -void *get_bone_from_selectbuffer(Scene *scene, Base *base, unsigned int *buffer, short hits, short findunsel) +void *get_bone_from_selectbuffer(Scene *scene, Base *base, unsigned int *buffer, short hits, short findunsel, bool do_nearest) { Object *obedit = scene->obedit; // XXX get from context Bone *bone; @@ -82,6 +82,7 @@ void *get_bone_from_selectbuffer(Scene *scene, Base *base, unsigned int *buffer, unsigned int hitresult; short i; bool takeNext = false; + int minsel = 0xffffffff, minunsel = 0xffffffff; for (i = 0; i < hits; i++) { hitresult = buffer[3 + (i * 4)]; @@ -102,7 +103,7 @@ void *get_bone_from_selectbuffer(Scene *scene, Base *base, unsigned int *buffer, else sel = !(bone->flag & BONE_SELECTED); - data = bone; + data = bone; } else { data = NULL; @@ -123,14 +124,28 @@ void *get_bone_from_selectbuffer(Scene *scene, Base *base, unsigned int *buffer, if (data) { if (sel) { - if (!firstSel) firstSel = data; - takeNext = 1; + if (do_nearest) { + if (minsel > buffer[4 * i + 1]) { + firstSel = data; + minsel = buffer[4 * i + 1]; + } + } + else { + if (!firstSel) firstSel = data; + takeNext = 1; + } } else { - if (!firstunSel) - firstunSel = data; - if (takeNext) - return data; + if (do_nearest) { + if (minunsel > buffer[4 * i + 1]) { + firstunSel = data; + minunsel = buffer[4 * i + 1]; + } + } + else { + if (!firstunSel) firstunSel = data; + if (takeNext) return data; + } } } } @@ -163,7 +178,7 @@ void *get_nearest_bone(bContext *C, short findunsel, int x, int y) hits = view3d_opengl_select(&vc, buffer, MAXPICKBUF, &rect, true); if (hits > 0) - return get_bone_from_selectbuffer(vc.scene, vc.scene->basact, buffer, hits, findunsel); + return get_bone_from_selectbuffer(vc.scene, vc.scene->basact, buffer, hits, findunsel, true); return NULL; } diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c index ba105325b97..d75a23a6322 100644 --- a/source/blender/editors/armature/editarmature_sketch.c +++ b/source/blender/editors/armature/editarmature_sketch.c @@ -1492,9 +1492,9 @@ static int sk_getSelfIntersections(bContext *C, ListBase *list, SK_Stroke *gestu return added; } -static int cmpIntersections(void *i1, void *i2) +static int cmpIntersections(const void *i1, const void *i2) { - SK_Intersection *isect1 = i1, *isect2 = i2; + const SK_Intersection *isect1 = i1, *isect2 = i2; if (isect1->stroke == isect2->stroke) { if (isect1->before < isect2->before) { diff --git a/source/blender/editors/armature/pose_select.c b/source/blender/editors/armature/pose_select.c index 76284ba44de..ba5ef4f3b5d 100644 --- a/source/blender/editors/armature/pose_select.c +++ b/source/blender/editors/armature/pose_select.c @@ -133,14 +133,14 @@ void ED_pose_bone_select(Object *ob, bPoseChannel *pchan, bool select) /* called from editview.c, for mode-less pose selection */ /* assumes scene obact and basact is still on old situation */ int ED_do_pose_selectbuffer(Scene *scene, Base *base, unsigned int *buffer, short hits, - bool extend, bool deselect, bool toggle) + bool extend, bool deselect, bool toggle, bool do_nearest) { Object *ob = base->object; Bone *nearBone; if (!ob || !ob->pose) return 0; - nearBone = get_bone_from_selectbuffer(scene, base, buffer, hits, 1); + nearBone = get_bone_from_selectbuffer(scene, base, buffer, hits, 1, do_nearest); /* if the bone cannot be affected, don't do anything */ if ((nearBone) && !(nearBone->flag & BONE_UNSELECTABLE)) { diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index 1449453936f..4655deec4c4 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -977,9 +977,12 @@ static int move_cursor(bContext *C, int type, const bool select) EditFont *ef = cu->editfont; int cursmove = -1; + if ((select) && (ef->selstart == 0)) { + ef->selstart = ef->selend = ef->pos + 1; + } + switch (type) { case LINE_BEGIN: - if ((select) && (ef->selstart == 0)) ef->selstart = ef->selend = ef->pos + 1; while (ef->pos > 0) { if (ef->textbuf[ef->pos - 1] == '\n') break; if (ef->textbufinfo[ef->pos - 1].flag & CU_CHINFO_WRAP) break; @@ -989,7 +992,6 @@ static int move_cursor(bContext *C, int type, const bool select) break; case LINE_END: - if ((select) && (ef->selstart == 0)) ef->selstart = ef->selend = ef->pos + 1; while (ef->pos < ef->len) { if (ef->textbuf[ef->pos] == 0) break; if (ef->textbuf[ef->pos] == '\n') break; @@ -1002,7 +1004,6 @@ static int move_cursor(bContext *C, int type, const bool select) case PREV_WORD: { int pos = ef->pos; - if ((select) && (ef->selstart == 0)) ef->selstart = ef->selend = ef->pos + 1; BLI_str_cursor_step_wchar(ef->textbuf, ef->len, &pos, STRCUR_DIR_PREV, STRCUR_JUMP_DELIM, true); ef->pos = pos; cursmove = FO_CURS; @@ -1012,7 +1013,6 @@ static int move_cursor(bContext *C, int type, const bool select) case NEXT_WORD: { int pos = ef->pos; - if ((select) && (ef->selstart == 0)) ef->selstart = ef->selend = ef->pos + 1; BLI_str_cursor_step_wchar(ef->textbuf, ef->len, &pos, STRCUR_DIR_NEXT, STRCUR_JUMP_DELIM, true); ef->pos = pos; cursmove = FO_CURS; @@ -1020,35 +1020,29 @@ static int move_cursor(bContext *C, int type, const bool select) } case PREV_CHAR: - if ((select) && (ef->selstart == 0)) ef->selstart = ef->selend = ef->pos + 1; ef->pos--; cursmove = FO_CURS; break; case NEXT_CHAR: - if ((select) && (ef->selstart == 0)) ef->selstart = ef->selend = ef->pos + 1; ef->pos++; cursmove = FO_CURS; break; case PREV_LINE: - if ((select) && (ef->selstart == 0)) ef->selstart = ef->selend = ef->pos + 1; cursmove = FO_CURSUP; break; case NEXT_LINE: - if ((select) && (ef->selstart == 0)) ef->selstart = ef->selend = ef->pos + 1; cursmove = FO_CURSDOWN; break; case PREV_PAGE: - if ((select) && (ef->selstart == 0)) ef->selstart = ef->selend = ef->pos + 1; cursmove = FO_PAGEUP; break; case NEXT_PAGE: - if ((select) && (ef->selstart == 0)) ef->selstart = ef->selend = ef->pos + 1; cursmove = FO_PAGEDOWN; break; } diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h index 6eac9f14bf6..24c80cbf005 100644 --- a/source/blender/editors/include/ED_armature.h +++ b/source/blender/editors/include/ED_armature.h @@ -123,7 +123,7 @@ void ED_armature_deselect_all(struct Object *obedit, int toggle); void ED_armature_deselect_all_visible(struct Object *obedit); int ED_do_pose_selectbuffer(struct Scene *scene, struct Base *base, unsigned int *buffer, - short hits, bool extend, bool deselect, bool toggle); + short hits, bool extend, bool deselect, bool toggle, bool do_nearest); bool mouse_armature(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); diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h index db13c628ade..a9995de068e 100644 --- a/source/blender/editors/include/ED_image.h +++ b/source/blender/editors/include/ED_image.h @@ -69,8 +69,6 @@ void ED_image_point_pos__reverse(struct SpaceImage *sima, struct ARegion *ar, co bool ED_space_image_show_render(struct SpaceImage *sima); bool ED_space_image_show_paint(struct SpaceImage *sima); bool ED_space_image_show_uvedit(struct SpaceImage *sima, struct Object *obedit); -bool ED_space_image_show_texpaint(struct SpaceImage *sima, struct Object *ob); -bool ED_space_image_show_uvshadow(struct SpaceImage *sima, struct Object *obedit); bool ED_space_image_paint_curve(const struct bContext *C); diff --git a/source/blender/editors/include/ED_render.h b/source/blender/editors/include/ED_render.h index 14595a4c668..ab1dbabe793 100644 --- a/source/blender/editors/include/ED_render.h +++ b/source/blender/editors/include/ED_render.h @@ -35,7 +35,6 @@ struct ID; struct Main; struct MTex; struct Render; -struct RenderInfo; struct Scene; struct ScrArea; struct RegionView3D; @@ -56,18 +55,6 @@ void ED_render_scene_update(struct Main *bmain, struct Scene *scene, int updated void ED_viewport_render_kill_jobs(const struct bContext *C, bool free_database); struct Scene *ED_render_job_get_scene(const struct bContext *C); -/* render_preview.c */ - -/* stores rendered preview - is also used for icons */ -typedef struct RenderInfo { - int pr_rectx; - int pr_recty; - short curtile, tottile; - rcti disprect; /* storage for view3d preview rect */ - unsigned int *rect; - struct Render *re; /* persistent render */ -} RenderInfo; - /* Render the preview * * pr_method: diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 1e9756ff771..bc794bf3350 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -295,7 +295,6 @@ typedef enum { #define UI_GRAD_L_ALT 10 #define UI_PALETTE_COLOR 20 -#define UI_PALETTE_COLOR_ACTIVE 1 /* Drawing * diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c index fa0832b6273..48e54270e95 100644 --- a/source/blender/editors/interface/interface_anim.c +++ b/source/blender/editors/interface/interface_anim.c @@ -61,7 +61,7 @@ static FCurve *ui_but_get_fcurve(uiBut *but, bAction **action, bool *r_driven) * but works well enough in typical cases */ int rnaindex = (but->rnaindex == -1) ? 0 : but->rnaindex; - return rna_get_fcurve(&but->rnapoin, but->rnaprop, rnaindex, action, r_driven); + return rna_get_fcurve_context_ui(but->block->evil_C, &but->rnapoin, but->rnaprop, rnaindex, action, r_driven); } void ui_but_anim_flag(uiBut *but, float cfra) diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 33bb46ced7f..9138ac92ab9 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -3111,8 +3111,9 @@ static int ui_do_but_KEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data, c } } else if (data->state == BUTTON_STATE_WAIT_KEY_EVENT) { - if (event->type == MOUSEMOVE) + if (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) { return WM_UI_HANDLER_CONTINUE; + } if (event->val == KM_PRESS) { if (WM_key_event_string(event->type)[0]) @@ -4255,11 +4256,21 @@ static bool ui_numedit_but_NORMAL(uiBut *but, uiHandleButtonData *data, return changed; } +static void ui_palette_set_active(uiBut *but) +{ + if ((int)(but->a1) == UI_PALETTE_COLOR) { + Palette *palette = but->rnapoin.id.data; + PaletteColor *color = but->rnapoin.data; + palette->active_color = BLI_findindex(&palette->colors, color); + } +} + static int ui_do_but_COLOR(bContext *C, uiBut *but, uiHandleButtonData *data, const wmEvent *event) { if (data->state == BUTTON_STATE_HIGHLIGHT) { /* first handle click on icondrag type button */ if (event->type == LEFTMOUSE && but->dragpoin && event->val == KM_PRESS) { + ui_palette_set_active(but); if (ui_but_mouse_inside_icon(but, data->region, event)) { button_activate_state(C, but, BUTTON_STATE_WAIT_DRAG); data->dragstartx = event->x; @@ -4269,6 +4280,7 @@ static int ui_do_but_COLOR(bContext *C, uiBut *but, uiHandleButtonData *data, co } #ifdef USE_DRAG_TOGGLE if (event->type == LEFTMOUSE && event->val == KM_PRESS) { + ui_palette_set_active(but); button_activate_state(C, but, BUTTON_STATE_WAIT_DRAG); data->dragstartx = event->x; data->dragstarty = event->y; @@ -4277,6 +4289,7 @@ static int ui_do_but_COLOR(bContext *C, uiBut *but, uiHandleButtonData *data, co #endif /* regular open menu */ if (ELEM(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { + ui_palette_set_active(but); button_activate_state(C, but, BUTTON_STATE_MENU_OPEN); return WM_UI_HANDLER_BREAK; } @@ -4306,9 +4319,7 @@ static int ui_do_but_COLOR(bContext *C, uiBut *but, uiHandleButtonData *data, co else if ((int)(but->a1) == UI_PALETTE_COLOR && event->type == DELKEY && event->val == KM_PRESS) { - Scene *scene = CTX_data_scene(C); - Paint *paint = BKE_paint_get_active(scene); - Palette *palette = BKE_paint_palette(paint); + Palette *palette = but->rnapoin.id.data; PaletteColor *color = but->rnapoin.data; BKE_palette_color_remove(palette, color); @@ -4333,13 +4344,6 @@ static int ui_do_but_COLOR(bContext *C, uiBut *but, uiHandleButtonData *data, co if (event->type == LEFTMOUSE && event->val == KM_RELEASE) { if ((int)(but->a1) == UI_PALETTE_COLOR) { - Palette *palette = but->rnapoin.id.data; - PaletteColor *color = but->rnapoin.data; - palette->active_color = BLI_findindex(&palette->colors, color); - - /* enforce redraw, sometimes state here can already be exit */ - ED_region_tag_redraw(data->region); - if (!event->ctrl) { float color[3]; Scene *scene = CTX_data_scene(C); diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index cdc611a60f4..2f66c4a9900 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -225,7 +225,7 @@ struct uiBut { * (type == NUM), Use to store RNA 'precision' value, for dragging and click-step. * (type == LABEL), If (a1 == 1.0f) use a2 as a blending factor. * (type == SEARCH_MENU) Use as number or columns. - * (type == COLOR) Use as indication of active palette color + * (type == COLOR) Use as index in palette (not so good, needs refactor) */ float a2; diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 27af550b173..c2bd6d307d1 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -1442,7 +1442,7 @@ typedef struct CollItemSearch { int iconid; } CollItemSearch; -static int sort_search_items_list(void *a, void *b) +static int sort_search_items_list(const void *a, const void *b) { CollItemSearch *cis1 = (CollItemSearch *)a; CollItemSearch *cis2 = (CollItemSearch *)b; diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 364a62bd2a0..b0bea42e3bc 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -2407,8 +2407,7 @@ void uiTemplatePalette(uiLayout *layout, PointerRNA *ptr, const char *propname, RNA_pointer_create(&palette->id, &RNA_PaletteColor, color, &ptr); uiDefButR(block, COLOR, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, &ptr, "color", -1, 0.0, 1.0, - UI_PALETTE_COLOR, (col_id == palette->active_color) ? UI_PALETTE_COLOR_ACTIVE : 0.0, ""); - + UI_PALETTE_COLOR, col_id, ""); row_cols++; col_id++; } diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index ff46925edaa..11b9b9c83cc 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -2172,8 +2172,8 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti * glVertex2f(centx, centy); for (a = 0; a <= tot; a++, ang += radstep) { - float si = sin(ang); - float co = cos(ang); + float si = sinf(ang); + float co = cosf(ang); ui_hsvcircle_vals_from_pos(hsv, hsv + 1, rect, centx + co * radius, centy + si * radius); @@ -2898,11 +2898,18 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat widgetbase_draw(&wtb, wcol); - if (but->a1 == UI_PALETTE_COLOR && but->a2 == UI_PALETTE_COLOR_ACTIVE) { + if (but->a1 == UI_PALETTE_COLOR && ((Palette *)but->rnapoin.id.data)->active_color == (int)but->a2) { float width = rect->xmax - rect->xmin; float height = rect->ymax - rect->ymin; - - glColor4ubv((unsigned char *)wcol->outline); + /* find color luminance and change it slightly */ + float bw = rgb_to_bw(col); + + if (bw > 0.5) + bw -= 0.5; + else + bw += 0.5; + + glColor4f(bw, bw, bw, 1.0); glBegin(GL_TRIANGLES); glVertex2f(rect->xmin + 0.1f * width, rect->ymin + 0.9f * height); glVertex2f(rect->xmin + 0.1f * width, rect->ymin + 0.5f * height); @@ -3834,7 +3841,7 @@ void ui_draw_pie_center(uiBlock *block) int subd = 40; - float angle = atan2(pie_dir[1], pie_dir[0]); + float angle = atan2f(pie_dir[1], pie_dir[0]); float range = (block->pie_data.flags & UI_PIE_DEGREES_RANGE_LARGE) ? ((float)M_PI / 2.0f) : ((float)M_PI / 4.0f); glPushMatrix(); diff --git a/source/blender/editors/io/io_collada.c b/source/blender/editors/io/io_collada.c index a4130540b1b..bbf4447dd72 100644 --- a/source/blender/editors/io/io_collada.c +++ b/source/blender/editors/io/io_collada.c @@ -96,7 +96,9 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op) int use_object_instantiation; int sort_by_name; int export_transformation_type; - int open_sim; + int open_sim; + + int export_count; if (!RNA_struct_property_is_set(op->ptr, "filepath")) { BKE_report(op->reports, RPT_ERROR, "No filename given"); @@ -148,33 +150,36 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op) ED_object_editmode_load(CTX_data_edit_object(C)); - - if (collada_export(CTX_data_scene(C), - filepath, - apply_modifiers, - export_mesh_type, - selected, - include_children, - include_armatures, - include_shapekeys, - deform_bones_only, - - active_uv_only, - include_uv_textures, - include_material_textures, - use_texture_copies, - - triangulate, - use_object_instantiation, - sort_by_name, - export_transformation_type, - open_sim)) - { - return OPERATOR_FINISHED; + export_count = collada_export(CTX_data_scene(C), + filepath, + apply_modifiers, + export_mesh_type, + selected, + include_children, + include_armatures, + include_shapekeys, + deform_bones_only, + + active_uv_only, + include_uv_textures, + include_material_textures, + use_texture_copies, + + triangulate, + use_object_instantiation, + sort_by_name, + export_transformation_type, + open_sim); + + if (export_count == 0) { + BKE_report(op->reports, RPT_WARNING, "Export file is empty"); + return OPERATOR_CANCELLED; } else { - BKE_report(op->reports, RPT_WARNING, "Export file not created"); - return OPERATOR_CANCELLED; + char buff[100]; + sprintf(buff, "Exported %d Objects", export_count); + BKE_report(op->reports, RPT_INFO, buff); + return OPERATOR_FINISHED; } } @@ -350,8 +355,8 @@ void WM_OT_collada_export(wmOperatorType *ot) RNA_def_enum(ot->srna, "export_transformation_type_selection", prop_bc_export_transformation_type, 0, "Transform", "Transformation type for translation, scale and rotation"); - RNA_def_boolean(ot->srna, "open_sim", 0, "Export for OpenSim", - "Compatibility mode for OpenSim and compatible online worlds"); + RNA_def_boolean(ot->srna, "open_sim", 0, "Export to SL/OpenSim", + "Compatibility mode for SL, OpenSim and other compatible online worlds"); } diff --git a/source/blender/editors/mask/mask_edit.c b/source/blender/editors/mask/mask_edit.c index 1acdff8b824..e2eb32e86d9 100644 --- a/source/blender/editors/mask/mask_edit.c +++ b/source/blender/editors/mask/mask_edit.c @@ -550,6 +550,8 @@ void ED_keymap_mask(wmKeyConfig *keyconf) /* duplicate */ WM_keymap_add_item(keymap, "MASK_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0); + WM_keymap_add_item(keymap, "MASK_OT_copy_splines", CKEY, KM_PRESS, KM_CTRL, 0); + WM_keymap_add_item(keymap, "MASK_OT_paste_splines", VKEY, KM_PRESS, KM_CTRL, 0); /* for image editor only */ WM_keymap_add_item(keymap, "UV_OT_cursor_set", ACTIONMOUSE, KM_PRESS, 0, 0); diff --git a/source/blender/editors/mask/mask_ops.c b/source/blender/editors/mask/mask_ops.c index 9f8388f1fe0..c3959f90318 100644 --- a/source/blender/editors/mask/mask_ops.c +++ b/source/blender/editors/mask/mask_ops.c @@ -580,7 +580,10 @@ static bool spline_under_mouse_get(const bContext *C, } } } - if (closest_spline != NULL) { + /* TODO(sergey): Chech whether tesellated spline point is closer + * to the mouse than the spline center. + */ + if (closest_dist_squared < 32.0f * 32.0f && closest_spline != NULL) { *mask_layer_r = closest_layer; *mask_spline_r = closest_spline; return true; @@ -2294,6 +2297,10 @@ static int copy_splines_exec(bContext *C, wmOperator *UNUSED(op)) Mask *mask = CTX_data_edit_mask(C); MaskLayer *mask_layer = BKE_mask_layer_active(mask); + if (mask_layer == NULL) { + return OPERATOR_CANCELLED; + } + BKE_mask_clipboard_copy_from_layer(mask_layer); return OPERATOR_FINISHED; @@ -2331,6 +2338,10 @@ static int paste_splines_exec(bContext *C, wmOperator *UNUSED(op)) Mask *mask = CTX_data_edit_mask(C); MaskLayer *mask_layer = BKE_mask_layer_active(mask); + if (mask_layer == NULL) { + mask_layer = BKE_mask_layer_new(mask, ""); + } + BKE_mask_clipboard_paste_to_layer(CTX_data_main(C), mask_layer); /* TODO: only update edited splines */ diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 76c41adf444..f5a7e82a8a8 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -2157,7 +2157,7 @@ static ListBase *find_hole(KnifeTool_OpData *kcd, ListBase *fedges) static bool find_hole_chains(KnifeTool_OpData *kcd, ListBase *hole, BMFace *f, ListBase **mainchain, ListBase **sidechain) { - float **fco, **hco; + float (*fco)[2], (*hco)[2]; BMVert **fv; KnifeVert **hv; KnifeEdge **he; @@ -2179,8 +2179,8 @@ static bool find_hole_chains(KnifeTool_OpData *kcd, ListBase *hole, BMFace *f, L /* Gather 2d projections of hole and face vertex coordinates. * Use best-axis projection - not completely accurate, maybe revisit */ axis_dominant_v3(&ax, &ay, f->no); - hco = BLI_memarena_alloc(kcd->arena, nh * sizeof(float *)); - fco = BLI_memarena_alloc(kcd->arena, nf * sizeof(float *)); + hco = BLI_memarena_alloc(kcd->arena, nh * sizeof(float[2])); + fco = BLI_memarena_alloc(kcd->arena, nf * sizeof(float[2])); hv = BLI_memarena_alloc(kcd->arena, nh * sizeof(KnifeVert *)); fv = BLI_memarena_alloc(kcd->arena, nf * sizeof(BMVert *)); he = BLI_memarena_alloc(kcd->arena, nh * sizeof(KnifeEdge *)); @@ -2198,7 +2198,6 @@ static bool find_hole_chains(KnifeTool_OpData *kcd, ListBase *hole, BMFace *f, L kfv = kfvother; BLI_assert(kfv == kfe->v1 || kfv == kfe->v2); } - hco[i] = BLI_memarena_alloc(kcd->arena, 2 * sizeof(float)); hco[i][0] = kfv->co[ax]; hco[i][1] = kfv->co[ay]; hv[i] = kfv; @@ -2208,7 +2207,6 @@ static bool find_hole_chains(KnifeTool_OpData *kcd, ListBase *hole, BMFace *f, L j = 0; BM_ITER_ELEM (v, &iter, f, BM_VERTS_OF_FACE) { - fco[j] = BLI_memarena_alloc(kcd->arena, 2 * sizeof(float)); fco[j][0] = v->co[ax]; fco[j][1] = v->co[ay]; fv[j] = v; diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c index 59fbe739d03..b5508ef8b82 100644 --- a/source/blender/editors/mesh/editmesh_loopcut.c +++ b/source/blender/editors/mesh/editmesh_loopcut.c @@ -75,6 +75,9 @@ typedef struct RingSelOpData { float (*edges)[2][3]; int totedge; + float (*points)[3]; + int totpoint; + ViewContext vc; Object *ob; @@ -91,9 +94,8 @@ static void ringsel_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) { View3D *v3d = CTX_wm_view3d(C); RingSelOpData *lcd = arg; - int i; - if (lcd->totedge > 0) { + if ((lcd->totedge > 0) || (lcd->totpoint > 0)) { if (v3d && v3d->zbuf) glDisable(GL_DEPTH_TEST); @@ -101,12 +103,23 @@ static void ringsel_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) glMultMatrixf(lcd->ob->obmat); glColor3ub(255, 0, 255); - glBegin(GL_LINES); - for (i = 0; i < lcd->totedge; i++) { - glVertex3fv(lcd->edges[i][0]); - glVertex3fv(lcd->edges[i][1]); + if (lcd->totedge > 0) { + glEnableClientState(GL_VERTEX_ARRAY); + glVertexPointer(3, GL_FLOAT, 0, lcd->edges); + glDrawArrays(GL_LINES, 0, lcd->totedge * 2); + glDisableClientState(GL_VERTEX_ARRAY); + } + + if (lcd->totpoint > 0) { + glPointSize(3.0f); + + glEnableClientState(GL_VERTEX_ARRAY); + glVertexPointer(3, GL_FLOAT, 0, lcd->points); + glDrawArrays(GL_POINTS, 0, lcd->totpoint); + glDisableClientState(GL_VERTEX_ARRAY); + + glPointSize(1.0f); } - glEnd(); glPopMatrix(); if (v3d && v3d->zbuf) @@ -178,52 +191,43 @@ static void edgering_vcos_get(DerivedMesh *dm, BMVert *v[2][2], float r_cos[2][2 } } -static void edgering_sel(RingSelOpData *lcd, int previewlines, bool select) +static void edgering_vcos_get_pair(DerivedMesh *dm, BMVert *v[2], float r_cos[2][3]) { - BMEditMesh *em = lcd->em; - DerivedMesh *dm = EDBM_mesh_deform_dm_get(em); - BMEdge *eed_start = lcd->eed; - BMEdge *eed, *eed_last; - BMVert *v[2][2], *v_last; - BMWalker walker; - float (*edges)[2][3] = NULL; - BLI_array_declare(edges); - int i, tot = 0; - - memset(v, 0, sizeof(v)); - - if (!eed_start) - return; - - if (lcd->edges) { - MEM_freeN(lcd->edges); - lcd->edges = NULL; - lcd->totedge = 0; + if (dm) { + int j; + for (j = 0; j < 2; j++) { + dm->getVertCo(dm, BM_elem_index_get(v[j]), r_cos[j]); + } } - - if (!lcd->extend) { - EDBM_flag_disable_all(lcd->em, BM_ELEM_SELECT); + else { + int j; + for (j = 0; j < 2; j++) { + copy_v3_v3(r_cos[j], v[j]->co); + } } +} - if (select) { - BMW_init(&walker, em->bm, BMW_EDGERING, - BMW_MASK_NOP, BMW_MASK_NOP, BMW_MASK_NOP, - BMW_FLAG_TEST_HIDDEN, - BMW_NIL_LAY); - - for (eed = BMW_begin(&walker, eed_start); eed; eed = BMW_step(&walker)) { - BM_edge_select_set(em->bm, eed, true); - } - BMW_end(&walker); +static void edgering_preview_free(RingSelOpData *lcd) +{ + MEM_SAFE_FREE(lcd->edges); + lcd->totedge = 0; - return; - } + MEM_SAFE_FREE(lcd->points); + lcd->totpoint = 0; +} - if (dm) { - BM_mesh_elem_table_ensure(lcd->em->bm, BM_VERT); - } +static void edgering_preview_calc_edges(RingSelOpData *lcd, DerivedMesh *dm, const int previewlines) +{ + BMesh *bm = lcd->em->bm; + BMWalker walker; + BMEdge *eed_start = lcd->eed; + BMEdge *eed, *eed_last; + BMVert *v[2][2] = {{NULL}}, *v_last; + float (*edges)[2][3] = NULL; + BLI_array_declare(edges); + int i, tot = 0; - BMW_init(&walker, em->bm, BMW_EDGERING, + BMW_init(&walker, bm, BMW_EDGERING, BMW_MASK_NOP, BMW_MASK_NOP, BMW_MASK_NOP, BMW_FLAG_TEST_HIDDEN, BMW_NIL_LAY); @@ -261,7 +265,7 @@ static void edgering_sel(RingSelOpData *lcd, int previewlines, bool select) } eed_last = eed; } - + if ((eed_last != eed_start) && #ifdef BMW_EDGERING_NGON BM_edge_share_face_check(eed_last, eed_start) @@ -274,7 +278,7 @@ static void edgering_sel(RingSelOpData *lcd, int previewlines, bool select) v[1][1] = v[0][1]; edgering_find_order(eed_last, eed_start, v_last, v); - + BLI_array_grow_items(edges, previewlines); for (i = 1; i <= previewlines; i++) { @@ -298,15 +302,83 @@ static void edgering_sel(RingSelOpData *lcd, int previewlines, bool select) lcd->totedge = tot; } +static void edgering_preview_calc_points(RingSelOpData *lcd, DerivedMesh *dm, const int previewlines) +{ + float v_cos[2][3]; + float (*points)[3]; + int i, tot = 0; + + if (dm) { + BM_mesh_elem_table_ensure(lcd->em->bm, BM_VERT); + } + + points = MEM_mallocN(sizeof(*lcd->points) * previewlines, __func__); + + edgering_vcos_get_pair(dm, &lcd->eed->v1, v_cos); + + for (i = 1; i <= previewlines; i++) { + const float fac = (i / ((float)previewlines + 1)); + interp_v3_v3v3(points[tot], v_cos[0], v_cos[1], fac); + tot++; + } + + lcd->points = points; + lcd->totpoint = previewlines; +} + +static void edgering_preview_calc(RingSelOpData *lcd, const int previewlines) +{ + DerivedMesh *dm; + + BLI_assert(lcd->eed != NULL); + + edgering_preview_free(lcd); + + dm = EDBM_mesh_deform_dm_get(lcd->em); + if (dm) { + BM_mesh_elem_table_ensure(lcd->em->bm, BM_VERT); + } + + if (BM_edge_is_wire(lcd->eed)) { + edgering_preview_calc_points(lcd, dm, previewlines); + } + else { + edgering_preview_calc_edges(lcd, dm, previewlines); + } +} + +static void edgering_select(RingSelOpData *lcd) +{ + BMEditMesh *em = lcd->em; + BMEdge *eed_start = lcd->eed; + BMWalker walker; + BMEdge *eed; + + if (!eed_start) + return; + + if (!lcd->extend) { + EDBM_flag_disable_all(lcd->em, BM_ELEM_SELECT); + } + + BMW_init(&walker, em->bm, BMW_EDGERING, + BMW_MASK_NOP, BMW_MASK_NOP, BMW_MASK_NOP, + BMW_FLAG_TEST_HIDDEN, + BMW_NIL_LAY); + + for (eed = BMW_begin(&walker, eed_start); eed; eed = BMW_step(&walker)) { + BM_edge_select_set(em->bm, eed, true); + } + BMW_end(&walker); +} + static void ringsel_find_edge(RingSelOpData *lcd, const int previewlines) { if (lcd->eed) { - edgering_sel(lcd, previewlines, false); + edgering_preview_calc(lcd, previewlines); } - else if (lcd->edges) { - MEM_freeN(lcd->edges); - lcd->edges = NULL; - lcd->totedge = 0; + else { + edgering_preview_free(lcd); } } @@ -324,26 +396,37 @@ static void ringsel_finish(bContext *C, wmOperator *op) if (lcd->eed) { BMEditMesh *em = lcd->em; + BMVert *v_eed_orig[2] = {lcd->eed->v1, lcd->eed->v2}; - edgering_sel(lcd, cuts, true); + edgering_select(lcd); if (lcd->do_cut) { const bool is_macro = (op->opm != NULL); + /* a single edge (rare, but better support) */ + const bool is_single = (BM_edge_is_wire(lcd->eed)); + const int seltype = is_single ? SUBDIV_SELECT_INNER : SUBDIV_SELECT_LOOPCUT; + /* Enable gridfill, so that intersecting loopcut works as one would expect. * Note though that it will break edgeslide in this specific case. * See [#31939]. */ BM_mesh_esubdivide(em->bm, BM_ELEM_SELECT, smoothness, smooth_falloff, true, 0.0f, 0.0f, - cuts, - SUBDIV_SELECT_LOOPCUT, SUBD_PATH, 0, true, + cuts, seltype, SUBD_PATH, 0, true, use_only_quads, 0); /* when used in a macro tessface is already re-recalculated */ EDBM_update_generic(em, (is_macro == false), true); + if (is_single) { + /* de-select endpoints */ + BM_vert_select_set(em->bm, v_eed_orig[0], false); + BM_vert_select_set(em->bm, v_eed_orig[1], false); + + EDBM_selectmode_flush_ex(lcd->em, SCE_SELECT_VERTEX); + } /* we cant slide multiple edges in vertex select mode */ - if (is_macro && (cuts > 1) && (em->selectmode & SCE_SELECT_VERTEX)) { + else if (is_macro && (cuts > 1) && (em->selectmode & SCE_SELECT_VERTEX)) { EDBM_selectmode_disable(lcd->vc.scene, em, SCE_SELECT_VERTEX, SCE_SELECT_EDGE); } /* force edge slide to edge select mode in in face select mode */ @@ -378,8 +461,7 @@ static void ringsel_exit(bContext *UNUSED(C), wmOperator *op) /* deactivate the extra drawing stuff in 3D-View */ ED_region_draw_cb_exit(lcd->ar->type, lcd->draw_handle); - if (lcd->edges) - MEM_freeN(lcd->edges); + edgering_preview_free(lcd); ED_region_tag_redraw(lcd->ar); @@ -594,7 +676,7 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event) ringsel_exit(C, op); ED_area_headerprint(CTX_wm_area(C), NULL); - return OPERATOR_FINISHED; + return OPERATOR_CANCELLED; case ESCKEY: if (event->val == KM_RELEASE) { /* cancel */ diff --git a/source/blender/editors/mesh/editmesh_rip.c b/source/blender/editors/mesh/editmesh_rip.c index 3b993332db0..4f149bf2c52 100644 --- a/source/blender/editors/mesh/editmesh_rip.c +++ b/source/blender/editors/mesh/editmesh_rip.c @@ -309,8 +309,7 @@ static EdgeLoopPair *edbm_ripsel_looptag_helper(BMesh *bm) uid_start = uid; uid = uid_end + bm->totedge; - BLI_array_grow_one(eloop_pairs); - lp = &eloop_pairs[BLI_array_count(eloop_pairs) - 1]; + lp = BLI_array_append_ret(eloop_pairs); BM_edge_loop_pair(e_last, &lp->l_a, &lp->l_b); /* no need to check, we know this will be true */ @@ -323,8 +322,7 @@ static EdgeLoopPair *edbm_ripsel_looptag_helper(BMesh *bm) } /* null terminate */ - BLI_array_grow_one(eloop_pairs); - lp = &eloop_pairs[BLI_array_count(eloop_pairs) - 1]; + lp = BLI_array_append_ret(eloop_pairs); lp->l_a = lp->l_b = NULL; return eloop_pairs; diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index 9cdfb43ae15..473da4c9756 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -66,6 +66,8 @@ #include "UI_resources.h" +#include "bmesh_tools.h" + #include "mesh_intern.h" /* own include */ /* use bmesh operator flags for a few operators */ @@ -929,6 +931,96 @@ void MESH_OT_select_similar(wmOperatorType *ot) } +/* -------------------------------------------------------------------- */ +/* Select Similar Regions */ + +static int edbm_select_similar_region_exec(bContext *C, wmOperator *op) +{ + Object *obedit = CTX_data_edit_object(C); + BMEditMesh *em = BKE_editmesh_from_object(obedit); + BMesh *bm = em->bm; + bool changed = false; + + /* group vars */ + int *groups_array; + int (*group_index)[2]; + int group_tot; + int i; + + if (bm->totfacesel < 2) { + BKE_report(op->reports, RPT_ERROR, "No face regions selected"); + return OPERATOR_CANCELLED; + } + + groups_array = MEM_mallocN(sizeof(*groups_array) * bm->totfacesel, __func__); + group_tot = BM_mesh_calc_face_groups(bm, groups_array, &group_index, + NULL, NULL, + BM_ELEM_SELECT, BM_VERT); + + BM_mesh_elem_table_ensure(bm, BM_FACE); + + for (i = 0; i < group_tot; i++) { + ListBase faces_regions; + int tot; + + const int fg_sta = group_index[i][0]; + const int fg_len = group_index[i][1]; + int j; + BMFace **fg = MEM_mallocN(sizeof(*fg) * fg_len, __func__); + + + for (j = 0; j < fg_len; j++) { + fg[j] = BM_face_at_index(bm, groups_array[fg_sta + j]); + } + + tot = BM_mesh_region_match(bm, fg, fg_len, &faces_regions); + + MEM_freeN(fg); + + if (tot) { + LinkData *link; + while ((link = BLI_pophead(&faces_regions))) { + BMFace *f, **faces = link->data; + unsigned int i = 0; + while ((f = faces[i++])) { + BM_face_select_set(bm, f, true); + } + MEM_freeN(faces); + MEM_freeN(link); + + changed = true; + } + } + } + + MEM_freeN(groups_array); + + if (changed) { + WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit); + } + else { + BKE_report(op->reports, RPT_WARNING, "No matching face regions found"); + } + + return OPERATOR_FINISHED; +} + +void MESH_OT_select_similar_region(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Select Similar Regions"; + ot->idname = "MESH_OT_select_similar_region"; + ot->description = "Select similar face regions to the current selection"; + + /* api callbacks */ + ot->exec = edbm_select_similar_region_exec; + ot->poll = ED_operator_editmesh; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; +} + + /* **************** Mode Select *************** */ static int edbm_select_mode_exec(bContext *C, wmOperator *op) diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 3f1023b7fb4..20c7f4eb521 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -1288,7 +1288,8 @@ static int edbm_do_smooth_vertex_exec(bContext *C, wmOperator *op) bool mirrx = false, mirry = false, mirrz = false; int i, repeat; float clip_dist = 0.0f; - bool use_topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0; + const float fac = RNA_float_get(op->ptr, "factor"); + const bool use_topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0; const bool xaxis = RNA_boolean_get(op->ptr, "xaxis"); const bool yaxis = RNA_boolean_get(op->ptr, "yaxis"); @@ -1322,12 +1323,12 @@ static int edbm_do_smooth_vertex_exec(bContext *C, wmOperator *op) repeat = RNA_int_get(op->ptr, "repeat"); if (!repeat) repeat = 1; - + for (i = 0; i < repeat; i++) { if (!EDBM_op_callf(em, op, - "smooth_vert verts=%hv mirror_clip_x=%b mirror_clip_y=%b mirror_clip_z=%b clip_dist=%f " - "use_axis_x=%b use_axis_y=%b use_axis_z=%b", - BM_ELEM_SELECT, mirrx, mirry, mirrz, clip_dist, xaxis, yaxis, zaxis)) + "smooth_vert verts=%hv factor=%f mirror_clip_x=%b mirror_clip_y=%b mirror_clip_z=%b " + "clip_dist=%f use_axis_x=%b use_axis_y=%b use_axis_z=%b", + BM_ELEM_SELECT, fac, mirrx, mirry, mirrz, clip_dist, xaxis, yaxis, zaxis)) { return OPERATOR_CANCELLED; } @@ -1358,7 +1359,8 @@ void MESH_OT_vertices_smooth(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - RNA_def_int(ot->srna, "repeat", 1, 1, 1000, "Number of times to smooth the mesh", "", 1, 100); + RNA_def_float(ot->srna, "factor", 0.5f, -10.0f, 10.0f, "Smoothing", "Smoothing factor", 0.0f, 1.0f); + RNA_def_int(ot->srna, "repeat", 1, 1, 1000, "Repeat", "Number of times to smooth the mesh", 1, 100); RNA_def_boolean(ot->srna, "xaxis", 1, "X-Axis", "Smooth along the X axis"); RNA_def_boolean(ot->srna, "yaxis", 1, "Y-Axis", "Smooth along the Y axis"); RNA_def_boolean(ot->srna, "zaxis", 1, "Z-Axis", "Smooth along the Z axis"); diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index bf8559add6f..68471bfc2ba 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -47,6 +47,7 @@ #include "BKE_library.h" #include "BKE_main.h" #include "BKE_mesh.h" +#include "BKE_paint.h" #include "BKE_report.h" #include "BKE_editmesh.h" @@ -502,6 +503,12 @@ static int mesh_uv_texture_add_exec(bContext *C, wmOperator *UNUSED(op)) if (ED_mesh_uv_texture_add(me, NULL, true) == -1) return OPERATOR_CANCELLED; + if (ob->mode & OB_MODE_TEXTURE_PAINT) { + Scene *scene = CTX_data_scene(C); + BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL); + WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS, NULL); + } + return OPERATOR_FINISHED; } @@ -622,6 +629,12 @@ static int mesh_uv_texture_remove_exec(bContext *C, wmOperator *UNUSED(op)) if (!ED_mesh_uv_texture_remove_active(me)) return OPERATOR_CANCELLED; + if (ob->mode & OB_MODE_TEXTURE_PAINT) { + Scene *scene = CTX_data_scene(C); + BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL); + WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS, NULL); + } + return OPERATOR_FINISHED; } diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h index 76f6cb5ebb8..6ba91097ec4 100644 --- a/source/blender/editors/mesh/mesh_intern.h +++ b/source/blender/editors/mesh/mesh_intern.h @@ -137,6 +137,7 @@ void MESH_OT_rip_edge(struct wmOperatorType *ot); /* *** editmesh_select.c *** */ void MESH_OT_select_similar(struct wmOperatorType *ot); +void MESH_OT_select_similar_region(struct wmOperatorType *ot); void MESH_OT_select_mode(struct wmOperatorType *ot); void MESH_OT_loop_multi_select(struct wmOperatorType *ot); void MESH_OT_loop_select(struct wmOperatorType *ot); diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index 31653efa735..e7dc5a69d53 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -130,6 +130,7 @@ void ED_operatortypes_mesh(void) WM_operatortype_append(MESH_OT_edge_face_add); WM_operatortype_append(MESH_OT_shortest_path_pick); WM_operatortype_append(MESH_OT_select_similar); + WM_operatortype_append(MESH_OT_select_similar_region); WM_operatortype_append(MESH_OT_select_mode); WM_operatortype_append(MESH_OT_loop_multi_select); WM_operatortype_append(MESH_OT_mark_seam); @@ -342,7 +343,7 @@ void ED_keymap_mesh(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "MESH_OT_faces_select_linked_flat", FKEY, KM_PRESS, (KM_CTRL | KM_SHIFT | KM_ALT), 0); - WM_keymap_add_item(keymap, "MESH_OT_select_similar", GKEY, KM_PRESS, KM_SHIFT, 0); + WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_select_similar", GKEY, KM_PRESS, KM_SHIFT, 0); /* selection mode */ WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_select_mode", TABKEY, KM_PRESS, KM_CTRL, 0); diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index d252ae20270..16f4f61f92b 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -999,7 +999,7 @@ static int mirror_facerotation(MFace *a, MFace *b) return -1; } -static int mirror_facecmp(const void *a, const void *b) +static bool mirror_facecmp(const void *a, const void *b) { return (mirror_facerotation((MFace *)a, (MFace *)b) == -1); } diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c index 2402ecb498d..b8957514159 100644 --- a/source/blender/editors/object/object_bake.c +++ b/source/blender/editors/object/object_bake.c @@ -682,6 +682,7 @@ static void finish_bake_internal(BakeRender *bkr) } BKE_image_release_ibuf(ima, ibuf, NULL); + DAG_id_tag_update(&ima->id, 0); } } diff --git a/source/blender/editors/object/object_bake_api.c b/source/blender/editors/object/object_bake_api.c index 372ca33fa4b..5746f9efd56 100644 --- a/source/blender/editors/object/object_bake_api.c +++ b/source/blender/editors/object/object_bake_api.c @@ -56,6 +56,7 @@ #include "BKE_modifier.h" #include "BKE_mesh.h" #include "BKE_screen.h" +#include "BKE_depsgraph.h" #include "RE_engine.h" #include "RE_pipeline.h" @@ -260,13 +261,14 @@ static bool write_internal_bake_pixels( } /* force OpenGL reload */ -static void reset_images_gpu(BakeImages *bake_images) +static void refresh_images(BakeImages *bake_images) { int i; for (i = 0; i < bake_images->size; i++) { Image *ima = bake_images->data[i].image; if (ima->ok == IMA_OK_LOADED) { GPU_free_image(ima); + DAG_id_tag_update(&ima->id, 0); } } } @@ -966,7 +968,7 @@ cage_cleanup: } if (is_save_internal) - reset_images_gpu(&bake_images); + refresh_images(&bake_images); cleanup: diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 0d58eaee5fa..abc0516cf2b 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -2411,10 +2411,13 @@ static int drop_named_material_invoke(bContext *C, wmOperator *op, const wmEvent return OPERATOR_CANCELLED; assign_material(base->object, ma, 1, BKE_MAT_ASSIGN_USERPREF); - + + DAG_id_tag_update(&base->object->id, OB_RECALC_OB); + + WM_event_add_notifier(C, NC_OBJECT | ND_OB_SHADING, base->object); WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C)); WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_LINKS, ma); - + return OPERATOR_FINISHED; } diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index a1b8478a0e1..f19765a5344 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -974,7 +974,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) DAG_id_tag_update(&ob_other->id, OB_RECALC_OB | OB_RECALC_DATA); copy_v3_v3(centn, cent); - mul_mat3_m4_v3(ob_other->obmat, centn); /* ommit translation part */ + mul_mat3_m4_v3(ob_other->obmat, centn); /* omit translation part */ add_v3_v3(ob_other->loc, centn); BKE_object_where_is_calc(scene, ob_other); diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 6897861c81c..777bbabb6e8 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -4324,10 +4324,10 @@ static int vgroup_do_remap(Object *ob, const char *name_array, wmOperator *op) return OPERATOR_FINISHED; } -static int vgroup_sort_name(void *def_a_ptr, void *def_b_ptr) +static int vgroup_sort_name(const void *def_a_ptr, const void *def_b_ptr) { - bDeformGroup *def_a = (bDeformGroup *)def_a_ptr; - bDeformGroup *def_b = (bDeformGroup *)def_b_ptr; + const bDeformGroup *def_a = def_a_ptr; + const bDeformGroup *def_b = def_b_ptr; return BLI_natstrcmp(def_a->name, def_b->name); } diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 5401cef8351..76344b77dd3 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -319,7 +319,7 @@ void PE_hide_keys_time(Scene *scene, PTCacheEdit *edit, float cfra) if (pset->flag & PE_FADE_TIME && pset->selectmode==SCE_SELECT_POINT) { LOOP_POINTS { LOOP_KEYS { - if (fabs(cfra-*key->time) < pset->fade_frames) + if (fabsf(cfra - *key->time) < pset->fade_frames) key->flag &= ~PEK_HIDE; else { key->flag |= PEK_HIDE; @@ -463,7 +463,7 @@ static bool key_inside_circle(PEData *data, float rad, const float co[3], float dx= data->mval[0] - screen_co[0]; dy= data->mval[1] - screen_co[1]; - dist= sqrt(dx*dx + dy*dy); + dist = sqrtf(dx * dx + dy * dy); if (dist > rad) return 0; @@ -2932,7 +2932,7 @@ static void brush_cut(PEData *data, int pa_index) d= dv * rad2 - d*d; if (d > 0.0f) { - d= sqrt(d); + d= sqrtf(d); cut_time= -(v0*xo0 + v1*xo1 + d); @@ -3678,7 +3678,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr) pset->flag &= ~PE_LOCK_FIRST; if (((pset->brushtype == PE_BRUSH_ADD) ? - (sqrt(dx * dx + dy * dy) > pset->brush[PE_BRUSH_ADD].step) : (dx != 0 || dy != 0)) || bedit->first) + (sqrtf(dx * dx + dy * dy) > pset->brush[PE_BRUSH_ADD].step) : (dx != 0 || dy != 0)) || bedit->first) { PEData data= bedit->data; diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index 3972ed1c49e..b53891f4880 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -1063,8 +1063,8 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor WM_jobs_start(CTX_wm_manager(C), wm_job); } else { - short dummy_stop, dummy_do_update; - float dummy_progress; + short dummy_stop = 0, dummy_do_update = 0; + float dummy_progress = 0.0f; /* blocking, use with exec() */ fluidbake_startjob((void *)fb, &dummy_stop, &dummy_do_update, &dummy_progress); diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index 01f00a8458a..450a3b19889 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -88,6 +88,7 @@ #include "PIL_time.h" #include "RE_pipeline.h" +#include "RE_engine.h" #include "WM_api.h" #include "WM_types.h" @@ -213,6 +214,12 @@ void ED_preview_init_dbase(void) #endif } +static bool check_engine_supports_textures(Scene *scene) +{ + RenderEngineType *type = RE_engines_find(scene->r.engine); + return type->flag & RE_USE_TEXTURE_PREVIEW; +} + void ED_preview_free_dbase(void) { if (G_pr_main) @@ -299,7 +306,7 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre sce->r.cfra = scene->r.cfra; - if (id_type == ID_TE) { + if (id_type == ID_TE && !check_engine_supports_textures(scene)) { /* Force blender internal for texture icons and nodes render, * seems commonly used render engines does not support * such kind of rendering. @@ -751,12 +758,6 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs if (sp->pr_rect) RE_ResultGet32(re, sp->pr_rect); } - else { - /* validate owner */ - //if (ri->rect == NULL) - // ri->rect= MEM_mallocN(sizeof(int) * ri->pr_rectx*ri->pr_recty, "BIF_previewrender"); - //RE_ResultGet32(re, ri->rect); - } /* unassign the pointers, reset vars */ preview_prepare_scene(sp->scene, NULL, GS(id->name), sp); diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 72b4da64c3e..6c996bcbd67 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -58,6 +58,7 @@ #include "BKE_linestyle.h" #include "BKE_main.h" #include "BKE_material.h" +#include "BKE_paint.h" #include "BKE_report.h" #include "BKE_scene.h" #include "BKE_texture.h" @@ -102,8 +103,15 @@ static int material_slot_add_exec(bContext *C, wmOperator *UNUSED(op)) if (!ob) return OPERATOR_CANCELLED; - + object_add_material_slot(ob); + + if (ob->mode & OB_MODE_TEXTURE_PAINT) { + Scene *scene = CTX_data_scene(C); + BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL); + WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS, NULL); + } + WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); WM_event_add_notifier(C, NC_OBJECT | ND_OB_SHADING, ob); WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_PREVIEW, ob); @@ -138,8 +146,15 @@ static int material_slot_remove_exec(bContext *C, wmOperator *op) BKE_report(op->reports, RPT_ERROR, "Unable to remove material slot in edit mode"); return OPERATOR_CANCELLED; } - + object_remove_material_slot(ob); + + if (ob->mode & OB_MODE_TEXTURE_PAINT) { + Scene *scene = CTX_data_scene(C); + BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL); + WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS, NULL); + } + DAG_id_tag_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); WM_event_add_notifier(C, NC_OBJECT | ND_OB_SHADING, ob); diff --git a/source/blender/editors/render/render_update.c b/source/blender/editors/render/render_update.c index 6b58d3d55aa..df7ca9f11b2 100644 --- a/source/blender/editors/render/render_update.c +++ b/source/blender/editors/render/render_update.c @@ -166,7 +166,6 @@ void ED_render_engine_changed(Main *bmain) bScreen *sc; ScrArea *sa; Scene *scene; - Material *ma; for (sc = bmain->screen.first; sc; sc = sc->id.next) for (sa = sc->areabase.first; sa; sa = sa->next) @@ -176,13 +175,6 @@ void ED_render_engine_changed(Main *bmain) for (scene = bmain->scene.first; scene; scene = scene->id.next) ED_render_id_flush_update(bmain, &scene->id); - - /* reset texture painting. Sending one dependency graph signal for any material should - * refresh any texture slots */ - ma = bmain->mat.first; - if (ma) { - DAG_id_tag_update(&ma->id, 0); - } } /***************************** Updates *********************************** @@ -482,15 +474,22 @@ static void image_changed(Main *bmain, Image *ima) texture_changed(bmain, tex); } -static void scene_changed(Main *bmain, Scene *UNUSED(scene)) +static void scene_changed(Main *bmain, Scene *scene) { Object *ob; Material *ma; /* glsl */ - for (ob = bmain->object.first; ob; ob = ob->id.next) + for (ob = bmain->object.first; ob; ob = ob->id.next) { if (ob->gpulamp.first) GPU_lamp_free(ob); + + if (ob->mode & OB_MODE_TEXTURE_PAINT) { + BKE_texpaint_slots_refresh_object(scene, ob); + BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL); + GPU_drawobject_free(ob->derivedFinal); + } + } for (ma = bmain->mat.first; ma; ma = ma->id.next) if (ma->gpumaterial.first) diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index 7b9ede38b39..e27ef705fad 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -521,14 +521,15 @@ static int project_brush_radius(ViewContext *vc, } } -static int sculpt_get_brush_geometry(bContext *C, ViewContext *vc, - int x, int y, int *pixel_radius, - float location[3]) +static bool sculpt_get_brush_geometry( + bContext *C, ViewContext *vc, + int x, int y, int *pixel_radius, + float location[3]) { Scene *scene = CTX_data_scene(C); Paint *paint = BKE_paint_get_active_from_context(C); float mouse[2]; - int hit; + bool hit; mouse[0] = x; mouse[1] = y; @@ -1011,7 +1012,8 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused)) * special mode of drawing will go away */ if ((mode == PAINT_SCULPT) && vc.obact->sculpt) { float location[3]; - int pixel_radius, hit; + int pixel_radius; + bool hit; /* test if brush is over the mesh */ hit = sculpt_get_brush_geometry(C, &vc, x, y, &pixel_radius, location); diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 7c19528a049..f4189b512e5 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -57,6 +57,7 @@ #include "BKE_context.h" #include "BKE_depsgraph.h" +#include "BKE_DerivedMesh.h" #include "BKE_brush.h" #include "BKE_image.h" #include "BKE_main.h" @@ -87,6 +88,7 @@ #include "RNA_enum_types.h" #include "GPU_draw.h" +#include "GPU_buffers.h" #include "BIF_gl.h" #include "BIF_glutil.h" @@ -527,8 +529,11 @@ BlurKernel *paint_new_blur_kernel(Brush *br, bool proj) kernel->pixel_len = radius; } else { - radius = br->blur_kernel_radius; + if (br->blur_kernel_radius <= 0) + br->blur_kernel_radius = 1; + radius = br->blur_kernel_radius; + side = kernel->side = radius * 2 + 1; kernel->side_squared = kernel->side * kernel->side; kernel->wdata = MEM_mallocN(sizeof(float) * kernel->side_squared, "blur kernel data"); @@ -543,11 +548,11 @@ BlurKernel *paint_new_blur_kernel(Brush *br, bool proj) case KERNEL_GAUSSIAN: { - /* at standard deviation of 3.0 kernel is at about zero */ + /* at 3.0 standard deviations distance, kernel is about zero */ float standard_dev = radius / 3.0f; /* make the necessary adjustment to the value for use in the normal distribution formula */ - standard_dev = standard_dev * standard_dev * 2; + standard_dev = -standard_dev * standard_dev * 2; for (i = 0; i < side; i++) { for (j = 0; j < side; j++) { @@ -749,14 +754,16 @@ static PaintOperation *texture_paint_init(bContext *C, wmOperator *op, const flo copy_v2_v2(pop->prevmouse, mouse); copy_v2_v2(pop->startmouse, mouse); - if ((brush->imagepaint_tool == PAINT_TOOL_FILL) && (brush->flag & BRUSH_USE_GRADIENT)) { - pop->cursor = WM_paint_cursor_activate(CTX_wm_manager(C), image_paint_poll, gradient_draw_line, pop); - } - /* initialize from context */ if (CTX_wm_region_view3d(C)) { Object *ob = OBACT; - paint_proj_mesh_data_ensure(C, ob, op); + bool uvs, mat, tex, stencil; + if (!BKE_paint_proj_mesh_data_check(scene, ob, &uvs, &mat, &tex, &stencil)) { + BKE_paint_data_warning(op->reports, uvs, mat, tex, stencil); + MEM_freeN(pop); + WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS, NULL); + return NULL; + } pop->mode = PAINT_MODE_3D_PROJECT; pop->custom_paint = paint_proj_new_stroke(C, ob, mouse, mode); } @@ -770,6 +777,10 @@ static PaintOperation *texture_paint_init(bContext *C, wmOperator *op, const flo return NULL; } + if ((brush->imagepaint_tool == PAINT_TOOL_FILL) && (brush->flag & BRUSH_USE_GRADIENT)) { + pop->cursor = WM_paint_cursor_activate(CTX_wm_manager(C), image_paint_poll, gradient_draw_line, pop); + } + settings->imapaint.flag |= IMAGEPAINT_DRAWING; ED_undo_paint_push_begin(UNDO_PAINT_IMAGE, op->type->name, ED_image_undo_restore, ED_image_undo_free, NULL); @@ -1378,28 +1389,31 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op) * cache in case we are loading a file */ BKE_texpaint_slots_refresh_object(scene, ob); - paint_proj_mesh_data_ensure(C, ob, op); - + BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL); + /* entering paint mode also sets image to editors */ if (imapaint->mode == IMAGEPAINT_MODE_MATERIAL) { Material *ma = give_current_material(ob, ob->actcol); /* set the current material active paint slot on image editor */ - if (ma->texpaintslot) + if (ma && ma->texpaintslot) ima = ma->texpaintslot[ma->paint_active_slot].ima; } else if (imapaint->mode == IMAGEPAINT_MODE_MATERIAL) { ima = imapaint->canvas; } - for (sc = bmain->screen.first; sc; sc = sc->id.next) { - ScrArea *sa; - for (sa = sc->areabase.first; sa; sa = sa->next) { - SpaceLink *sl; - for (sl = sa->spacedata.first; sl; sl = sl->next) { - if (sl->spacetype == SPACE_IMAGE) { - SpaceImage *sima = (SpaceImage *)sl; - - ED_space_image_set(sima, scene, scene->obedit, ima); + if (ima) { + for (sc = bmain->screen.first; sc; sc = sc->id.next) { + ScrArea *sa; + for (sa = sc->areabase.first; sa; sa = sa->next) { + SpaceLink *sl; + for (sl = sa->spacedata.first; sl; sl = sl->next) { + if (sl->spacetype == SPACE_IMAGE) { + SpaceImage *sima = (SpaceImage *)sl; + + if (!sima->pin) + ED_space_image_set(sima, scene, scene->obedit, ima); + } } } } @@ -1416,7 +1430,7 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op) toggle_paint_cursor(C, 1); } - DAG_id_tag_update(&ob->id, OB_RECALC_DATA); + GPU_drawobject_free(ob->derivedFinal); WM_event_add_notifier(C, NC_SCENE | ND_MODE, scene); return OPERATOR_FINISHED; @@ -1482,12 +1496,17 @@ void PAINT_OT_brush_colors_flip(wmOperatorType *ot) void ED_imapaint_bucket_fill(struct bContext *C, float color[3], wmOperator *op) { + SpaceImage *sima = CTX_wm_space_image(C); + Image *ima = sima->image; + ED_undo_paint_push_begin(UNDO_PAINT_IMAGE, op->type->name, ED_image_undo_restore, ED_image_undo_free, NULL); paint_2d_bucket_fill(C, color, NULL, NULL, NULL); ED_undo_paint_push_end(UNDO_PAINT_IMAGE); + + DAG_id_tag_update(&ima->id, 0); } diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c index 165888b3c09..5530f947b8c 100644 --- a/source/blender/editors/sculpt_paint/paint_image_2d.c +++ b/source/blender/editors/sculpt_paint/paint_image_2d.c @@ -1564,7 +1564,7 @@ void paint_2d_gradient_fill( sub_v2_v2v2(tangent, image_final, image_init); line_len = len_squared_v2(tangent); line_len_sq_inv = 1.0f / line_len; - line_len = sqrt(line_len); + line_len = sqrtf(line_len); do_float = (ibuf->rect_float != NULL); diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 0fb3e278f40..f9124db7a5e 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -74,6 +74,7 @@ #include "BKE_material.h" #include "BKE_mesh.h" #include "BKE_mesh_mapping.h" +#include "BKE_node.h" #include "BKE_paint.h" #include "BKE_report.h" #include "BKE_scene.h" @@ -84,6 +85,7 @@ #include "ED_image.h" #include "ED_mesh.h" +#include "ED_node.h" #include "ED_paint.h" #include "ED_screen.h" #include "ED_uvedit.h" @@ -362,7 +364,7 @@ static TexPaintSlot *project_paint_face_paint_slot(const ProjPaintState *ps, int { MFace *mf = ps->dm_mface + face_index; Material *ma = ps->dm->mat[mf->mat_nr]; - return ma->texpaintslot + ma->paint_active_slot; + return ma ? ma->texpaintslot + ma->paint_active_slot : NULL; } static Image *project_paint_face_paint_image(const ProjPaintState *ps, int face_index) @@ -373,7 +375,7 @@ static Image *project_paint_face_paint_image(const ProjPaintState *ps, int face_ else { MFace *mf = ps->dm_mface + face_index; Material *ma = ps->dm->mat[mf->mat_nr]; - TexPaintSlot *slot = ma->texpaintslot + ma->paint_active_slot; + TexPaintSlot *slot = ma ? ma->texpaintslot + ma->paint_active_slot : NULL; return slot ? slot->ima : ps->canvas_ima; } } @@ -382,14 +384,14 @@ static TexPaintSlot *project_paint_face_clone_slot(const ProjPaintState *ps, int { MFace *mf = ps->dm_mface + face_index; Material *ma = ps->dm->mat[mf->mat_nr]; - return ma->texpaintslot + ma->paint_clone_slot; + return ma ? ma->texpaintslot + ma->paint_clone_slot : NULL; } static Image *project_paint_face_clone_image(const ProjPaintState *ps, int face_index) { MFace *mf = ps->dm_mface + face_index; Material *ma = ps->dm->mat[mf->mat_nr]; - TexPaintSlot *slot = ma->texpaintslot + ma->paint_clone_slot; + TexPaintSlot *slot = ma ? ma->texpaintslot + ma->paint_clone_slot : NULL; return slot ? slot->ima : ps->clone_ima; } @@ -4077,7 +4079,7 @@ static void *do_projectpaint_thread(void *ph_v) sub_v2_v2v2(tangent, pos, lastpos); line_len = len_squared_v2(tangent); line_len_sq_inv = 1.0f / line_len; - line_len = sqrt(line_len); + line_len = sqrtf(line_len); switch (brush->gradient_fill_mode) { case BRUSH_GRADIENT_LINEAR: @@ -4533,9 +4535,14 @@ static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps, int settings->imapaint.clone : NULL; /* setup projection painting data */ - ps->do_backfacecull = (settings->imapaint.flag & IMAGEPAINT_PROJECT_BACKFACE) ? 0 : 1; - ps->do_occlude = (settings->imapaint.flag & IMAGEPAINT_PROJECT_XRAY) ? 0 : 1; - ps->do_mask_normal = (settings->imapaint.flag & IMAGEPAINT_PROJECT_FLAT) ? 0 : 1; + if (ps->tool != PAINT_TOOL_FILL) { + ps->do_backfacecull = (settings->imapaint.flag & IMAGEPAINT_PROJECT_BACKFACE) ? 0 : 1; + ps->do_occlude = (settings->imapaint.flag & IMAGEPAINT_PROJECT_XRAY) ? 0 : 1; + ps->do_mask_normal = (settings->imapaint.flag & IMAGEPAINT_PROJECT_FLAT) ? 0 : 1; + } + else { + ps->do_backfacecull = ps->do_occlude = ps->do_mask_normal = 0; + } ps->do_new_shading_nodes = BKE_scene_use_new_shading_nodes(scene); /* only cache the value */ if (ps->tool == PAINT_TOOL_CLONE) @@ -4660,13 +4667,18 @@ static int texture_paint_camera_project_exec(bContext *C, wmOperator *op) IDProperty *idgroup; IDProperty *view_data = NULL; Object *ob = OBACT; + bool uvs, mat, tex; if (ob == NULL || ob->type != OB_MESH) { BKE_report(op->reports, RPT_ERROR, "No active mesh object"); return OPERATOR_CANCELLED; } - paint_proj_mesh_data_ensure(C, ob, op); + if (!BKE_paint_proj_mesh_data_check(scene, ob, &uvs, &mat, &tex, NULL)) { + BKE_paint_data_warning(op->reports, uvs, mat, tex, true); + WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS, NULL); + return OPERATOR_CANCELLED; + } project_state_init(C, ob, &ps, BRUSH_STROKE_NORMAL); @@ -4858,108 +4870,78 @@ void PAINT_OT_image_from_view(wmOperatorType *ot) * Data generation for projective texturing * * *******************************************/ +void BKE_paint_data_warning(struct ReportList *reports, bool uvs, bool mat, bool tex, bool stencil) +{ + BKE_reportf(reports, RPT_WARNING, "Missing%s%s%s%s detected!", + !uvs ? " UVs," : "", + !mat ? " Materials," : "", + !tex ? " Textures," : "", + !stencil ? " Stencil," : "" + ); +} /* Make sure that active object has a material, and assign UVs and image layers if they do not exist */ -void paint_proj_mesh_data_ensure(bContext *C, Object *ob, wmOperator *op) +bool BKE_paint_proj_mesh_data_check(Scene *scene, Object *ob, bool *uvs, bool *mat, bool *tex, bool *stencil) { Mesh *me; int layernum; - ImagePaintSettings *imapaint = &(CTX_data_tool_settings(C)->imapaint); - bScreen *sc; - Scene *scene = CTX_data_scene(C); - Main *bmain = CTX_data_main(C); + ImagePaintSettings *imapaint = &scene->toolsettings->imapaint; Brush *br = BKE_paint_brush(&imapaint->paint); + bool hasmat = true; + bool hastex = true; + bool hasstencil = true; + bool hasuvs = true; + imapaint->missing_data = 0; + BLI_assert(ob->type == OB_MESH); - /* no material, add one */ - if (ob->totcol == 0) { - Material *ma = BKE_material_add(CTX_data_main(C), "Material"); - /* no material found, just assign to first slot */ - assign_material(ob, ma, 1, BKE_MAT_ASSIGN_USERPREF); - proj_paint_add_slot(C, ma, NULL); - } - else { - /* there may be material slots but they may be empty, check */ - int i; - - for (i = 1; i < ob->totcol + 1; i++) { - Material *ma = give_current_material(ob, i); - - if (ma) { - if (imapaint->mode == IMAGEPAINT_MODE_MATERIAL) { + if (imapaint->mode == IMAGEPAINT_MODE_MATERIAL) { + /* no material, add one */ + if (ob->totcol == 0) { + hasmat = false; + hastex = false; + } + else { + /* there may be material slots but they may be empty, check */ + int i; + hasmat = false; + hastex = false; + + for (i = 1; i < ob->totcol + 1; i++) { + Material *ma = give_current_material(ob, i); + + if (ma) { + hasmat = true; if (!ma->texpaintslot) { /* refresh here just in case */ BKE_texpaint_slot_refresh_cache(scene, ma); /* if still no slots, we have to add */ - if (!ma->texpaintslot) { - proj_paint_add_slot(C, ma, NULL); - - if (ma->texpaintslot) { - for (sc = bmain->screen.first; sc; sc = sc->id.next) { - ScrArea *sa; - for (sa = sc->areabase.first; sa; sa = sa->next) { - SpaceLink *sl; - for (sl = sa->spacedata.first; sl; sl = sl->next) { - if (sl->spacetype == SPACE_IMAGE) { - SpaceImage *sima = (SpaceImage *)sl; - - ED_space_image_set(sima, scene, scene->obedit, ma->texpaintslot[0].ima); - } - } - } - } - } + if (ma->texpaintslot) { + hastex = true; + break; } } + else { + hastex = true; + break; + } } } - else { - Material *ma = BKE_material_add(CTX_data_main(C), "Material"); - /* no material found, just assign to first slot */ - assign_material(ob, ma, i, BKE_MAT_ASSIGN_USERPREF); - proj_paint_add_slot(C, ma, NULL); - } } } - - if (imapaint->mode == IMAGEPAINT_MODE_IMAGE) { + else if (imapaint->mode == IMAGEPAINT_MODE_IMAGE) { if (imapaint->canvas == NULL) { - int width; - int height; - Main *bmain = CTX_data_main(C); - float color[4] = {0.0, 0.0, 0.0, 1.0}; - - width = 1024; - height = 1024; - imapaint->canvas = BKE_image_add_generated(bmain, width, height, "Canvas", 32, false, IMA_GENTYPE_BLANK, color); - - GPU_drawobject_free(ob->derivedFinal); - - for (sc = bmain->screen.first; sc; sc = sc->id.next) { - ScrArea *sa; - for (sa = sc->areabase.first; sa; sa = sa->next) { - SpaceLink *sl; - for (sl = sa->spacedata.first; sl; sl = sl->next) { - if (sl->spacetype == SPACE_IMAGE) { - SpaceImage *sima = (SpaceImage *)sl; - - ED_space_image_set(sima, scene, scene->obedit, imapaint->canvas); - } - } - } - } + hastex = false; } } - + me = BKE_mesh_from_object(ob); layernum = CustomData_number_of_layers(&me->pdata, CD_MTEXPOLY); if (layernum == 0) { - BKE_reportf(op->reports, RPT_WARNING, "Object did not have UV map, manual unwrap recommended"); - - ED_mesh_uv_texture_add(me, "UVMap", true); + hasuvs = false; } /* Make sure we have a stencil to paint on! */ @@ -4967,16 +4949,29 @@ void paint_proj_mesh_data_ensure(bContext *C, Object *ob, wmOperator *op) imapaint->flag |= IMAGEPAINT_PROJECT_LAYER_STENCIL; if (imapaint->stencil == NULL) { - int width; - int height; - Main *bmain = CTX_data_main(C); - float color[4] = {0.0, 0.0, 0.0, 1.0}; - - width = 1024; - height = 1024; - imapaint->stencil = BKE_image_add_generated(bmain, width, height, "Stencil", 32, false, IMA_GENTYPE_BLANK, color); + hasstencil = false; } } + + if (!hasuvs) imapaint->missing_data |= IMAGEPAINT_MISSING_UVS; + if (!hasmat) imapaint->missing_data |= IMAGEPAINT_MISSING_MATERIAL; + if (!hastex) imapaint->missing_data |= IMAGEPAINT_MISSING_TEX; + if (!hasstencil) imapaint->missing_data |= IMAGEPAINT_MISSING_STENCIL; + + if (uvs) { + *uvs = hasuvs; + } + if (mat) { + *mat = hasmat; + } + if (tex) { + *tex = hastex; + } + if (stencil) { + *stencil = hasstencil; + } + + return hasuvs && hasmat && hastex && hasstencil; } /* Add layer operator */ @@ -4999,30 +4994,74 @@ static EnumPropertyItem layer_type_items[] = { {0, NULL, 0, NULL, NULL} }; -bool proj_paint_add_slot(bContext *C, Material *ma, wmOperator *op) +static Image *proj_paint_image_create(wmOperator *op, Main *bmain) +{ + Image *ima; + float color[4] = {0.0f, 0.0f, 0.0f, 1.0f}; + char imagename[MAX_ID_NAME - 2] = "Material Diffuse Color"; + int width = 1024; + int height = 1024; + bool use_float = false; + short gen_type = IMA_GENTYPE_BLANK; + bool alpha = false; + + if (op) { + width = RNA_int_get(op->ptr, "width"); + height = RNA_int_get(op->ptr, "height"); + use_float = RNA_boolean_get(op->ptr, "float"); + gen_type = RNA_enum_get(op->ptr, "generated_type"); + RNA_float_get_array(op->ptr, "color", color); + alpha = RNA_boolean_get(op->ptr, "alpha"); + RNA_string_get(op->ptr, "name", imagename); + } + ima = BKE_image_add_generated(bmain, width, height, imagename, alpha ? 32 : 24, use_float, + gen_type, color); + + return ima; +} + +static bool proj_paint_add_slot(bContext *C, wmOperator *op) { Object *ob = CTX_data_active_object(C); Scene *scene = CTX_data_scene(C); + Material *ma; bool is_bi = BKE_scene_uses_blender_internal(scene); + Image *ima = NULL; if (!ob) return false; - if (!ma) - ma = give_current_material(ob, ob->actcol); + ma = give_current_material(ob, ob->actcol); if (ma) { + Main *bmain = CTX_data_main(C); - if (!is_bi || ma->use_nodes) { - /* not supported for now */ + if (!is_bi && BKE_scene_use_new_shading_nodes(scene)) { + bNode *imanode; + bNodeTree *ntree = ma->nodetree; + + if (!ntree) { + ED_node_shader_default(C, &ma->id); + ntree = ma->nodetree; + } + + ma->use_nodes = true; + + /* try to add an image node */ + imanode = nodeAddStaticNode(C, ntree, SH_NODE_TEX_IMAGE); + + ima = proj_paint_image_create(op, bmain); + imanode->id = &ima->id; + + nodeSetActive(ntree, imanode); + + ntreeUpdateTree(CTX_data_main(C), ntree); } else { MTex *mtex = add_mtex_id(&ma->id, -1); /* successful creation of mtex layer, now create set */ if (mtex) { - Main *bmain = CTX_data_main(C); - Image *ima; int type = MAP_COL; int type_id = 0; @@ -5042,47 +5081,36 @@ bool proj_paint_add_slot(bContext *C, Material *ma, wmOperator *op) mtex->mapto = type; if (mtex->tex) { - float color[4] = {0.0f, 0.0f, 0.0f, 1.0f}; - char imagename[MAX_ID_NAME - 2] = "Material Diffuse Color"; - int width = 1024; - int height = 1024; - bool use_float = false; - short gen_type = IMA_GENTYPE_BLANK; - bool alpha = false; - - if (op) { - width = RNA_int_get(op->ptr, "width"); - height = RNA_int_get(op->ptr, "height"); - use_float = RNA_boolean_get(op->ptr, "float"); - gen_type = RNA_enum_get(op->ptr, "generated_type"); - RNA_float_get_array(op->ptr, "color", color); - alpha = RNA_boolean_get(op->ptr, "alpha"); - RNA_string_get(op->ptr, "name", imagename); - } - - ima = mtex->tex->ima = BKE_image_add_generated(bmain, width, height, imagename, alpha ? 32 : 24, use_float, - gen_type, color); - - BKE_texpaint_slot_refresh_cache(scene, ma); - BKE_image_signal(ima, NULL, IMA_SIGNAL_USER_NEW_IMAGE); - WM_event_add_notifier(C, NC_TEXTURE | NA_ADDED, mtex->tex); - WM_event_add_notifier(C, NC_IMAGE | NA_ADDED, ima); - DAG_id_tag_update(&ma->id, 0); - ED_area_tag_redraw(CTX_wm_area(C)); + ima = mtex->tex->ima = proj_paint_image_create(op, bmain); } WM_event_add_notifier(C, NC_TEXTURE, CTX_data_scene(C)); - return true; } + WM_event_add_notifier(C, NC_TEXTURE | NA_ADDED, mtex->tex); + } + + if (ima) { + BKE_texpaint_slot_refresh_cache(scene, ma); + BKE_image_signal(ima, NULL, IMA_SIGNAL_USER_NEW_IMAGE); + WM_event_add_notifier(C, NC_IMAGE | NA_ADDED, ima); + DAG_id_tag_update(&ma->id, 0); + ED_area_tag_redraw(CTX_wm_area(C)); + + return true; } } - + return false; } static int texture_paint_add_texture_paint_slot_exec(bContext *C, wmOperator *op) { - return proj_paint_add_slot(C, NULL, op); + if (proj_paint_add_slot(C, op)) { + return OPERATOR_FINISHED; + } + else { + return OPERATOR_CANCELLED; + } } @@ -5093,6 +5121,12 @@ static int texture_paint_add_texture_paint_slot_invoke(bContext *C, wmOperator * Material *ma = give_current_material(ob, ob->actcol); int type = RNA_enum_get(op->ptr, "type"); + if (!ma) { + ma = BKE_material_add(CTX_data_main(C), "Material"); + /* no material found, just assign to first slot */ + assign_material(ob, ma, ob->actcol, BKE_MAT_ASSIGN_USERPREF); + } + type = RNA_enum_from_value(layer_type_items, type); /* get the name of the texture layer type */ @@ -5180,7 +5214,7 @@ void PAINT_OT_delete_texture_paint_slot(wmOperatorType *ot) { /* identifiers */ ot->name = "Delete Texture Paint Slot"; - ot->description = "Add a texture paint slot"; + ot->description = "Delete selected texture paint slot"; ot->idname = "PAINT_OT_delete_texture_paint_slot"; /* api callbacks */ diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h index 5e1ac0cf8a8..c3b7ec60e71 100644 --- a/source/blender/editors/sculpt_paint/paint_intern.h +++ b/source/blender/editors/sculpt_paint/paint_intern.h @@ -169,8 +169,6 @@ void *paint_proj_new_stroke(struct bContext *C, struct Object *ob, const float m void paint_proj_stroke(const struct bContext *C, void *ps, const float prevmval_i[2], const float mval_i[2], const bool eraser, float pressure, float distance, float size); void paint_proj_redraw(const struct bContext *C, void *pps, bool final); void paint_proj_stroke_done(void *ps); -void paint_proj_mesh_data_ensure(bContext *C, struct Object *ob, struct wmOperator *op); -bool proj_paint_add_slot(bContext *C, struct Material *ma, struct wmOperator *op); void paint_brush_color_get(struct Scene *scene, struct Brush *br, bool color_correction, bool invert, float distance, float pressure, float color[3], struct ColorManagedDisplay *display); bool paint_use_opacity_masking(struct Brush *brush); diff --git a/source/blender/editors/sculpt_paint/paint_mask.c b/source/blender/editors/sculpt_paint/paint_mask.c index 8faa4cfaf33..24ef735affe 100644 --- a/source/blender/editors/sculpt_paint/paint_mask.c +++ b/source/blender/editors/sculpt_paint/paint_mask.c @@ -319,7 +319,7 @@ static void mask_lasso_px_cb(int x, int y, void *user_data) static int paint_mask_gesture_lasso_exec(bContext *C, wmOperator *op) { int mcords_tot; - int (*mcords)[2] = (int (*)[2])WM_gesture_lasso_path_to_array(C, op, &mcords_tot); + const int (*mcords)[2] = WM_gesture_lasso_path_to_array(C, op, &mcords_tot); if (mcords) { float clip_planes[4][4], clip_planes_final[4][4]; @@ -349,13 +349,13 @@ static int paint_mask_gesture_lasso_exec(bContext *C, wmOperator *op) ob = vc.obact; ED_view3d_ob_project_mat_get(vc.rv3d, ob, data.projviewobjmat); - BLI_lasso_boundbox(&data.rect, (const int (*)[2])mcords, mcords_tot); + BLI_lasso_boundbox(&data.rect, mcords, mcords_tot); data.width = data.rect.xmax - data.rect.xmin; - data.px = MEM_callocN(sizeof(*data.px) * data.width * (data.rect.ymax - data.rect.ymin), "lasso_mask_pixel_buffer"); + data.px = MEM_callocN(sizeof(*data.px) * data.width * (data.rect.ymax - data.rect.ymin), __func__); fill_poly_v2i_n( data.rect.xmin, data.rect.ymin, data.rect.xmax, data.rect.ymax, - (const int (*)[2])mcords, mcords_tot, + mcords, mcords_tot, mask_lasso_px_cb, &data); ED_view3d_clipping_calc(&bb, clip_planes, &mats, &data.rect); diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index 90161fa87dd..dc6be9caa53 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -228,8 +228,9 @@ static int palette_color_delete_exec(bContext *C, wmOperator *UNUSED(op)) { Paint *paint = BKE_paint_get_active_from_context(C); Palette *palette = paint->palette; + PaletteColor *color = BLI_findlink(&palette->colors, palette->active_color); - BKE_palette_color_delete(palette); + BKE_palette_color_remove(palette, color); return OPERATOR_FINISHED; } @@ -666,7 +667,7 @@ static void stencil_set_target(StencilControlData *scd) scd->lenorig = len_v2(mdiff); - scd->init_angle = atan2(mdiff[1], mdiff[0]); + scd->init_angle = atan2f(mdiff[1], mdiff[0]); } static int stencil_control_invoke(bContext *C, wmOperator *op, const wmEvent *event) @@ -762,7 +763,7 @@ static void stencil_control_calculate(StencilControlData *scd, const int mval[2] { float angle; sub_v2_v2v2(mdiff, mvalf, scd->pos_target); - angle = atan2(mdiff[1], mdiff[0]); + angle = atan2f(mdiff[1], mdiff[0]); angle = scd->init_rot + angle - scd->init_angle; if (angle < 0.0f) angle += (float)(2 * M_PI); @@ -915,7 +916,7 @@ static int stencil_fit_image_aspect_exec(bContext *C, wmOperator *op) stencil_area = br->stencil_dimension[0] * br->stencil_dimension[1]; } - factor = sqrt(stencil_area / orig_area); + factor = sqrtf(stencil_area / orig_area); if (do_mask) { br->mask_stencil_dimension[0] = factor * aspx; diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 8f189b49aa6..101d176b00f 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -283,9 +283,9 @@ static bool paint_brush_update(bContext *C, const float dx = mouse[0] - stroke->initial_mouse[0]; const float dy = mouse[1] - stroke->initial_mouse[1]; - ups->anchored_size = ups->pixel_radius = sqrt(dx * dx + dy * dy); + ups->anchored_size = ups->pixel_radius = sqrtf(dx * dx + dy * dy); - ups->brush_rotation = atan2(dx, dy) + M_PI; + ups->brush_rotation = atan2f(dx, dy) + M_PI; if (brush->flag & BRUSH_EDGE_TO_EDGE) { halfway[0] = dx * 0.5f + stroke->initial_mouse[0]; @@ -498,7 +498,7 @@ static float paint_stroke_overlapped_curve(Brush *br, float x, float spacing) for (i = 0; i < n; i++) { float xx; - xx = fabs(x0 + i * h); + xx = fabsf(x0 + i * h); if (xx < 1.0f) sum += BKE_brush_curve_strength(br, xx, 1); @@ -758,7 +758,7 @@ bool paint_supports_smooth_stroke(Brush *br, PaintMode mode) bool paint_supports_texture(PaintMode mode) { - /* ommit: PAINT_WEIGHT, PAINT_SCULPT_UV, PAINT_INVALID */ + /* omit: PAINT_WEIGHT, PAINT_SCULPT_UV, PAINT_INVALID */ return ELEM(mode, PAINT_SCULPT, PAINT_VERTEX, PAINT_TEXTURE_PROJECTIVE, PAINT_TEXTURE_2D); } diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index f34d0ff3f7b..e03c8a5f106 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -395,7 +395,7 @@ static Image *imapaint_face_image(DerivedMesh *dm, int face_index) Image *ima; MFace *mf = dm->getTessFaceArray(dm) + face_index; Material *ma = dm->mat[mf->mat_nr]; - ima = ma->texpaintslot[ma->paint_active_slot].ima; + ima = ma ? ma->texpaintslot[ma->paint_active_slot].ima : NULL; return ima; } diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 33d0510c08a..766048d54bb 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -192,8 +192,8 @@ typedef struct StrokeCache { float true_location[3]; float location[3]; - float pen_flip; - float invert; + bool pen_flip; + bool invert; float pressure; float mouse[2]; float bstrength; @@ -550,7 +550,7 @@ static bool sculpt_brush_test(SculptBrushTest *test, const float co[3]) if (sculpt_brush_test_clipping(test, co)) { return 0; } - test->dist = sqrt(distsq); + test->dist = sqrtf(distsq); return 1; } else { @@ -809,10 +809,10 @@ static float brush_strength(Sculpt *sd, StrokeCache *cache, float feather, Unifi return alpha * pressure * feather; case SCULPT_TOOL_SNAKE_HOOK: - return feather; + return root_alpha * feather; case SCULPT_TOOL_GRAB: - return feather; + return root_alpha * feather; case SCULPT_TOOL_ROTATE: return alpha * pressure * feather; @@ -2553,7 +2553,7 @@ static void do_flatten_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totno sub_v3_v3v3(val, intr, vd.co); if (plane_trim(ss->cache, brush, val)) { - const float fade = bstrength * tex_strength(ss, brush, vd.co, sqrt(test.dist), + const float fade = bstrength * tex_strength(ss, brush, vd.co, sqrtf(test.dist), vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f); mul_v3_v3fl(proxy[vd.i], val, fade); @@ -2626,7 +2626,7 @@ static void do_clay_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode) sub_v3_v3v3(val, intr, vd.co); if (plane_trim(ss->cache, brush, val)) { - const float fade = bstrength * tex_strength(ss, brush, vd.co, sqrt(test.dist), + const float fade = bstrength * tex_strength(ss, brush, vd.co, sqrtf(test.dist), vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f); mul_v3_v3fl(proxy[vd.i], val, fade); @@ -2792,7 +2792,7 @@ static void do_fill_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode) if (plane_trim(ss->cache, brush, val)) { const float fade = bstrength * tex_strength(ss, brush, vd.co, - sqrt(test.dist), + sqrtf(test.dist), vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f); mul_v3_v3fl(proxy[vd.i], val, fade); @@ -2856,7 +2856,7 @@ static void do_scrape_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod if (plane_trim(ss->cache, brush, val)) { const float fade = bstrength * tex_strength(ss, brush, vd.co, - sqrt(test.dist), + sqrtf(test.dist), vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f); mul_v3_v3fl(proxy[vd.i], val, fade); @@ -2899,7 +2899,7 @@ static void do_gravity(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode, fl BKE_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) { if (sculpt_brush_test_sq(&test, vd.co)) { - const float fade = tex_strength(ss, brush, vd.co, sqrt(test.dist), vd.no, + const float fade = tex_strength(ss, brush, vd.co, sqrtf(test.dist), vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f); mul_v3_v3fl(proxy[vd.i], offset, fade); @@ -4006,14 +4006,14 @@ static void sculpt_stroke_modifiers_check(const bContext *C, Object *ob) typedef struct { SculptSession *ss; const float *ray_start, *ray_normal; - int hit; + bool hit; float dist; int original; } SculptRaycastData; typedef struct { const float *ray_start, *ray_normal; - int hit; + bool hit; float dist; float detail; } SculptDetailRaycastData; @@ -4145,7 +4145,7 @@ static void sculpt_brush_init_tex(const Scene *scene, Sculpt *sd, SculptSession sculpt_update_tex(scene, sd, ss); } -static int sculpt_brush_stroke_init(bContext *C, wmOperator *op) +static bool sculpt_brush_stroke_init(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); Object *ob = CTX_data_active_object(C); diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c index 292d6236bab..d90eaafa379 100644 --- a/source/blender/editors/sculpt_paint/sculpt_uv.c +++ b/source/blender/editors/sculpt_paint/sculpt_uv.c @@ -273,7 +273,7 @@ static void HC_relaxation_iteration_uv(BMEditMesh *em, UvSculptData *sculptdata, Temp_UVData *tmp_uvdata; float diff[2]; int i; - float radius_root = sqrt(radius); + float radius_root = sqrtf(radius); Brush *brush = BKE_paint_brush(sculptdata->uvsculpt); tmp_uvdata = (Temp_UVData *)MEM_callocN(sculptdata->totalUniqueUvs * sizeof(Temp_UVData), "Temporal data"); @@ -316,7 +316,7 @@ static void HC_relaxation_iteration_uv(BMEditMesh *em, UvSculptData *sculptdata, if ((dist = dot_v2v2(diff, diff)) <= radius) { UvElement *element; float strength; - strength = alpha * BKE_brush_curve_strength(brush, sqrt(dist), radius_root); + strength = alpha * BKE_brush_curve_strength(brush, sqrtf(dist), radius_root); sculptdata->uv[i].uv[0] = (1.0f - strength) * sculptdata->uv[i].uv[0] + strength * (tmp_uvdata[i].p[0] - 0.5f * (tmp_uvdata[i].b[0] + tmp_uvdata[i].sum_b[0] / tmp_uvdata[i].ncounter)); sculptdata->uv[i].uv[1] = (1.0f - strength) * sculptdata->uv[i].uv[1] + strength * (tmp_uvdata[i].p[1] - 0.5f * (tmp_uvdata[i].b[1] + tmp_uvdata[i].sum_b[1] / tmp_uvdata[i].ncounter)); @@ -345,7 +345,7 @@ static void laplacian_relaxation_iteration_uv(BMEditMesh *em, UvSculptData *scul Temp_UVData *tmp_uvdata; float diff[2]; int i; - float radius_root = sqrt(radius); + float radius_root = sqrtf(radius); Brush *brush = BKE_paint_brush(sculptdata->uvsculpt); tmp_uvdata = (Temp_UVData *)MEM_callocN(sculptdata->totalUniqueUvs * sizeof(Temp_UVData), "Temporal data"); @@ -380,7 +380,7 @@ static void laplacian_relaxation_iteration_uv(BMEditMesh *em, UvSculptData *scul if ((dist = dot_v2v2(diff, diff)) <= radius) { UvElement *element; float strength; - strength = alpha * BKE_brush_curve_strength(brush, sqrt(dist), radius_root); + strength = alpha * BKE_brush_curve_strength(brush, sqrtf(dist), radius_root); sculptdata->uv[i].uv[0] = (1.0f - strength) * sculptdata->uv[i].uv[0] + strength * tmp_uvdata[i].p[0]; sculptdata->uv[i].uv[1] = (1.0f - strength) * sculptdata->uv[i].uv[1] + strength * tmp_uvdata[i].p[1]; @@ -434,7 +434,7 @@ static void uv_sculpt_stroke_apply(bContext *C, wmOperator *op, const wmEvent *e /* We will compare squares to save some computation */ radius = radius * radius; - radius_root = sqrt(radius); + radius_root = sqrtf(radius); /* * Pinch Tool @@ -455,7 +455,7 @@ static void uv_sculpt_stroke_apply(bContext *C, wmOperator *op, const wmEvent *e if ((dist = dot_v2v2(diff, diff)) <= radius) { UvElement *element; float strength; - strength = alpha * BKE_brush_curve_strength(brush, sqrt(dist), radius_root); + strength = alpha * BKE_brush_curve_strength(brush, sqrtf(dist), radius_root); normalize_v2(diff); sculptdata->uv[i].uv[0] -= strength * diff[0] * 0.001f; @@ -563,7 +563,7 @@ static unsigned int uv_edge_hash(const void *key) BLI_ghashutil_uinthash(edge->uv1)); } -static int uv_edge_compare(const void *a, const void *b) +static bool uv_edge_compare(const void *a, const void *b) { UvEdge *edge1 = (UvEdge *)a; UvEdge *edge2 = (UvEdge *)b; @@ -803,7 +803,7 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, const wm aspectRatio = width / (float)height; radius /= (width * zoomx); radius = radius * radius; - radius_root = sqrt(radius); + radius_root = sqrtf(radius); /* Allocate selection stack */ data->initial_stroke = MEM_mallocN(sizeof(*data->initial_stroke), "uv_sculpt_initial_stroke"); @@ -829,7 +829,7 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, const wm diff[1] /= aspectRatio; if ((dist = dot_v2v2(diff, diff)) <= radius) { float strength; - strength = alpha * BKE_brush_curve_strength(brush, sqrt(dist), radius_root); + strength = alpha * BKE_brush_curve_strength(brush, sqrtf(dist), radius_root); data->initial_stroke->initialSelection[counter].uv = i; data->initial_stroke->initialSelection[counter].strength = strength; diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index a6fbb0c399d..a797a60f74c 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -754,6 +754,10 @@ static void clip_keymap(struct wmKeyConfig *keyconf) RNA_string_set(kmi->ptr, "data_path", "space_data.pivot_point"); RNA_string_set(kmi->ptr, "value", "INDIVIDUAL_ORIGINS"); + /* Copy-paste */ + WM_keymap_add_item(keymap, "CLIP_OT_copy_tracks", CKEY, KM_PRESS, KM_CTRL, 0); + WM_keymap_add_item(keymap, "CLIP_OT_paste_tracks", VKEY, KM_PRESS, KM_CTRL, 0); + /* ******** Hotkeys avalaible for preview region only ******** */ keymap = WM_keymap_find(keyconf, "Clip Graph Editor", SPACE_CLIP, 0); diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index abbffcd8546..fb6b1a0033c 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -3811,7 +3811,9 @@ static int paste_tracks_exec(bContext *C, wmOperator *UNUSED(op)) MovieClip *clip = ED_space_clip_get_clip(sc); MovieTracking *tracking = &clip->tracking; MovieTrackingObject *object = BKE_tracking_object_get_active(tracking); + ListBase *tracks_base = BKE_tracking_object_get_tracks(tracking, object); + BKE_tracking_tracks_deselect_all(tracks_base); BKE_tracking_clipboard_paste_tracks(tracking, object); WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, clip); diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c index d049a45fd90..1915f45fc87 100644 --- a/source/blender/editors/space_file/fsmenu.c +++ b/source/blender/editors/space_file/fsmenu.c @@ -443,7 +443,7 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks) if (pathString == NULL || !CFStringGetCString(pathString, line, sizeof(line), kCFStringEncodingASCII)) continue; - fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, FS_INSERT_SORTED); + fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, NULL); CFRelease(pathString); CFRelease(cfURL); diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index 7e90008d8d2..ed6e6ba1e1b 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -809,6 +809,10 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char uiItemR(col, &imaptr, "use_generated_float", 0, NULL, ICON_NONE); uiItemR(split, &imaptr, "generated_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE); + + if (ima->gen_type == IMA_GENTYPE_BLANK) { + uiItemR(layout, &imaptr, "generated_color", 0, NULL, ICON_NONE); + } } } diff --git a/source/blender/editors/space_image/image_edit.c b/source/blender/editors/space_image/image_edit.c index 24b1c54dd9f..757059ebc29 100644 --- a/source/blender/editors/space_image/image_edit.c +++ b/source/blender/editors/space_image/image_edit.c @@ -303,13 +303,6 @@ bool ED_space_image_show_paint(SpaceImage *sima) return (sima->mode == SI_MODE_PAINT); } -bool ED_space_image_show_texpaint(SpaceImage *sima, Object *ob) -{ - return (ob && ob->type == OB_MESH && - ob->mode == OB_MODE_TEXTURE_PAINT && - !(sima->flag & SI_NO_DRAW_TEXPAINT)); -} - bool ED_space_image_show_uvedit(SpaceImage *sima, Object *obedit) { if (sima && (ED_space_image_show_render(sima) || ED_space_image_show_paint(sima))) @@ -327,24 +320,6 @@ bool ED_space_image_show_uvedit(SpaceImage *sima, Object *obedit) return false; } -bool ED_space_image_show_uvshadow(SpaceImage *sima, Object *obedit) -{ - if (ED_space_image_show_render(sima)) - return false; - - if (ED_space_image_show_paint(sima)) - if (obedit && obedit->type == OB_MESH) { - struct BMEditMesh *em = BKE_editmesh_from_object(obedit); - bool ret; - - ret = EDBM_mtexpoly_check(em); - - return ret && !(sima->flag & SI_NO_DRAW_TEXPAINT); - } - - return false; -} - /* matches clip function */ bool ED_space_image_check_show_maskedit(Scene *scene, SpaceImage *sima) { diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index c87e547b6ea..58b56e99119 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -49,17 +49,20 @@ #include "BKE_colortools.h" #include "BKE_context.h" #include "BKE_depsgraph.h" +#include "BKE_DerivedMesh.h" #include "BKE_icons.h" #include "BKE_image.h" #include "BKE_global.h" #include "BKE_library.h" #include "BKE_main.h" #include "BKE_packedFile.h" +#include "BKE_paint.h" #include "BKE_report.h" #include "BKE_screen.h" #include "BKE_sound.h" #include "GPU_draw.h" +#include "GPU_buffers.h" #include "IMB_colormanagement.h" #include "IMB_imbuf.h" @@ -1001,10 +1004,10 @@ static void image_sequence_get_frames(PointerRNA *ptr, ListBase *frames, char *p RNA_END } -static int image_cmp_frame(void *a, void *b) +static int image_cmp_frame(const void *a, const void *b) { - ImageFrame *frame_a = (ImageFrame *)a; - ImageFrame *frame_b = (ImageFrame *)b; + const ImageFrame *frame_a = a; + const ImageFrame *frame_b = b; if (frame_a->framenr < frame_b->framenr) return -1; if (frame_a->framenr > frame_b->framenr) return 1; @@ -1905,6 +1908,12 @@ void IMAGE_OT_reload(wmOperatorType *ot) /********************** new image operator *********************/ #define IMA_DEF_NAME N_("Untitled") +enum { + GEN_CONTEXT_NONE = 0, + GEN_CONTEXT_PAINT_CANVAS = 1, + GEN_CONTEXT_PAINT_STENCIL = 2 +}; + static int image_new_exec(bContext *C, wmOperator *op) { SpaceImage *sima; @@ -1918,6 +1927,7 @@ static int image_new_exec(bContext *C, wmOperator *op) char *name = _name; float color[4]; int width, height, floatbuf, gen_type, alpha; + int gen_context; /* retrieve state */ sima = CTX_wm_space_image(C); @@ -1937,6 +1947,7 @@ static int image_new_exec(bContext *C, wmOperator *op) gen_type = RNA_enum_get(op->ptr, "generated_type"); RNA_float_get_array(op->ptr, "color", color); alpha = RNA_boolean_get(op->ptr, "alpha"); + gen_context = RNA_enum_get(op->ptr, "gen_context"); if (!alpha) color[3] = 1.0f; @@ -1961,6 +1972,40 @@ static int image_new_exec(bContext *C, wmOperator *op) else if (sima) { ED_space_image_set(sima, scene, obedit, ima); } + else if (gen_context == GEN_CONTEXT_PAINT_CANVAS) { + bScreen *sc; + Object *ob = CTX_data_active_object(C); + + GPU_drawobject_free(ob->derivedFinal); + if (scene->toolsettings->imapaint.canvas) + id_us_min(&scene->toolsettings->imapaint.canvas->id); + scene->toolsettings->imapaint.canvas = ima; + + for (sc = bmain->screen.first; sc; sc = sc->id.next) { + ScrArea *sa; + for (sa = sc->areabase.first; sa; sa = sa->next) { + SpaceLink *sl; + for (sl = sa->spacedata.first; sl; sl = sl->next) { + if (sl->spacetype == SPACE_IMAGE) { + SpaceImage *sima = (SpaceImage *)sl; + + if (!sima->pin) + ED_space_image_set(sima, scene, scene->obedit, ima); + } + } + } + } + BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL); + WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS, NULL); + } + else if (gen_context == GEN_CONTEXT_PAINT_STENCIL) { + Object *ob = CTX_data_active_object(C); + if (scene->toolsettings->imapaint.stencil) + id_us_min(&scene->toolsettings->imapaint.stencil->id); + scene->toolsettings->imapaint.stencil = ima; + BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL); + WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS, NULL); + } else { Tex *tex = CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data; if (tex && tex->type == TEX_IMAGE) { @@ -1991,6 +2036,13 @@ void IMAGE_OT_new(wmOperatorType *ot) { PropertyRNA *prop; static float default_color[4] = {0.0f, 0.0f, 0.0f, 1.0f}; + + static EnumPropertyItem gen_context_items[] = { + {GEN_CONTEXT_NONE, "NONE", 0, "None", ""}, + {GEN_CONTEXT_PAINT_CANVAS, "PAINT_CANVAS", 0, "Paint Canvas", ""}, + {GEN_CONTEXT_PAINT_STENCIL, "PAINT_STENCIL", 0, "Paint Stencil", ""}, + {0, NULL, 0, NULL, NULL} + }; /* identifiers */ ot->name = "New Image"; @@ -2017,7 +2069,7 @@ void IMAGE_OT_new(wmOperatorType *ot) RNA_def_enum(ot->srna, "generated_type", image_generated_type_items, IMA_GENTYPE_BLANK, "Generated Type", "Fill the image with a grid for UV map testing"); RNA_def_boolean(ot->srna, "float", 0, "32 bit Float", "Create image with 32 bit floating point bit depth"); - prop = RNA_def_boolean(ot->srna, "texstencil", 0, "Stencil", "Set Image as stencil"); + prop = RNA_def_enum(ot->srna, "gen_context", gen_context_items, 0, "Gen Context", "Generation context"); RNA_def_property_flag(prop, PROP_HIDDEN); } diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index ffe9f13af3f..ab616bf592f 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -540,7 +540,7 @@ static void image_listener(bScreen *sc, ScrArea *sa, wmNotifier *wmn) break; } case NC_WM: - if(wmn->data == ND_UNDO) { + if (wmn->data == ND_UNDO) { ED_area_tag_redraw(sa); ED_area_tag_refresh(sa); } diff --git a/source/blender/editors/space_node/node_relationships.c b/source/blender/editors/space_node/node_relationships.c index 97a2383c03f..973ce56857c 100644 --- a/source/blender/editors/space_node/node_relationships.c +++ b/source/blender/editors/space_node/node_relationships.c @@ -67,12 +67,12 @@ typedef struct bNodeListItem { struct bNode *node; } bNodeListItem; -static int sort_nodes_locx(void *a, void *b) +static int sort_nodes_locx(const void *a, const void *b) { - bNodeListItem *nli1 = (bNodeListItem *)a; - bNodeListItem *nli2 = (bNodeListItem *)b; - bNode *node1 = nli1->node; - bNode *node2 = nli2->node; + const bNodeListItem *nli1 = a; + const bNodeListItem *nli2 = b; + const bNode *node1 = nli1->node; + const bNode *node2 = nli2->node; if (node1->locx > node2->locx) return 1; diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c index 5a78ea6ebd8..de580f612a0 100644 --- a/source/blender/editors/space_node/node_select.c +++ b/source/blender/editors/space_node/node_select.c @@ -248,22 +248,34 @@ static bool node_select_grouped_name(SpaceNode *snode, bNode *node_act, const bo bNode *node; bool changed = false; const unsigned int delims[] = {'.', '-', '_', '\0'}; - size_t index_act, index_curr; + size_t pref_len_act, pref_len_curr; char *sep, *suf_act, *suf_curr; - index_act = BLI_str_partition_ex_utf8(node_act->name, delims, &sep, &suf_act, from_right); + pref_len_act = BLI_str_partition_ex_utf8(node_act->name, delims, &sep, &suf_act, from_right); - if (index_act > 0) { - for (node = snode->edittree->nodes.first; node; node = node->next) { - if ((node->flag & SELECT) == 0) { - index_curr = BLI_str_partition_ex_utf8(node->name, delims, &sep, &suf_curr, from_right); - if ((from_right && STREQ(suf_act, suf_curr)) || - (!from_right && (index_act == index_curr) && STREQLEN(node_act->name, node->name, index_act))) - { - nodeSetSelected(node, true); - changed = true; - } - } + /* Note: in case we are searching for suffix, and found none, use whole name as suffix. */ + if (from_right && !(sep && suf_act)) { + pref_len_act = 0; + suf_act = node_act->name; + } + + for (node = snode->edittree->nodes.first; node; node = node->next) { + if (node->flag & SELECT) { + continue; + } + pref_len_curr = BLI_str_partition_ex_utf8(node->name, delims, &sep, &suf_curr, from_right); + + /* Same as with active node name! */ + if (from_right && !(sep && suf_curr)) { + pref_len_curr = 0; + suf_curr = node->name; + } + + if ((from_right && STREQ(suf_act, suf_curr)) || + (!from_right && (pref_len_act == pref_len_curr) && STREQLEN(node_act->name, node->name, pref_len_act))) + { + nodeSetSelected(node, true); + changed = true; } } diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c index 875639da113..ccaeae34927 100644 --- a/source/blender/editors/space_node/space_node.c +++ b/source/blender/editors/space_node/space_node.c @@ -511,7 +511,7 @@ static void node_area_listener(bScreen *sc, ScrArea *sa, wmNotifier *wmn) } break; case NC_WM: - if(wmn->data == ND_UNDO) { + if (wmn->data == ND_UNDO) { ED_area_tag_refresh(sa); } break; diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index 95802be9ef9..af827d6dc5a 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -373,9 +373,11 @@ static const char *txt_utf8_forward_columns(const char *str, int columns, int *p static int text_draw_wrapped(SpaceText *st, const char *str, int x, int y, int w, const char *format, int skip) { + const bool use_syntax = (st->showsyntax && format); FlattenString fs; int basex, lines; int i, wrap, end, max, columns, padding; /* column */ + /* warning, only valid when 'use_syntax' is set */ int a, fstart, fpos; /* utf8 chars */ int mi, ma, mstart, mend; /* mem */ char fmt_prev = 0xff; @@ -397,8 +399,11 @@ static int text_draw_wrapped(SpaceText *st, const char *str, int x, int y, int w /* skip hidden part of line */ if (skip) { skip--; - fstart = fpos = end; - mstart = mend; + if (use_syntax) { + /* currently fpos only used when formatting */ + fpos += BLI_strnlen_utf8(str + mstart, mend - mstart); + } + fstart = fpos; mstart = mend; mend = txt_utf8_forward_columns(str + mend, max, &padding) - str; end = (wrap += max - padding); continue; @@ -406,7 +411,7 @@ static int text_draw_wrapped(SpaceText *st, const char *str, int x, int y, int w /* Draw the visible portion of text on the overshot line */ for (a = fstart, ma = mstart; ma < mend; a++, ma += BLI_str_utf8_size_safe(str + ma)) { - if (st->showsyntax && format) { + if (use_syntax) { if (fmt_prev != format[a]) format_draw_color(fmt_prev = format[a]); } x += text_font_draw_character_utf8(st, x, y, str + ma); @@ -428,7 +433,7 @@ static int text_draw_wrapped(SpaceText *st, const char *str, int x, int y, int w /* Draw the remaining text */ for (a = fstart, ma = mstart; str[ma] && y > 0; a++, ma += BLI_str_utf8_size_safe(str + ma)) { - if (st->showsyntax && format) { + if (use_syntax) { if (fmt_prev != format[a]) format_draw_color(fmt_prev = format[a]); } @@ -442,6 +447,7 @@ static int text_draw_wrapped(SpaceText *st, const char *str, int x, int y, int w static void text_draw(SpaceText *st, char *str, int cshift, int maxwidth, int x, int y, const char *format) { + const bool use_syntax = (st->showsyntax && format); FlattenString fs; int columns, size, n, w = 0, padding, amount = 0; const char *in = NULL; @@ -474,7 +480,7 @@ static void text_draw(SpaceText *st, char *str, int cshift, int maxwidth, int x, x += st->cwidth * padding; - if (st->showsyntax && format) { + if (use_syntax) { int a, str_shift = 0; char fmt_prev = 0xff; diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index 2e3d8d056e8..852edaac7dc 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -473,7 +473,9 @@ static void txt_write_file(Text *text, ReportList *reports) for (tmp = text->lines.first; tmp; tmp = tmp->next) { fputs(tmp->line, fp); - fputc('\n', fp); + if (tmp->next) { + fputc('\n', fp); + } } fclose(fp); diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c index 2fd4b0bc21d..88c57d45b79 100644 --- a/source/blender/editors/space_time/space_time.c +++ b/source/blender/editors/space_time/space_time.c @@ -405,6 +405,7 @@ static void time_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn) case NC_OBJECT: { switch (wmn->data) { + case ND_BONE_SELECT: case ND_BONE_ACTIVE: case ND_POINTCACHE: case ND_MODIFIER: diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index fb97a6ac9f4..fa9ba23e454 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -279,10 +279,10 @@ static bool set_draw_settings_cached(int clearcache, MTFace *texface, Material * if (!ma && BKE_image_has_alpha(texface->tpage)) alphablend = GPU_BLEND_ALPHA; } - else if (texpaint && ma) { + else if (texpaint) { if (gtexdraw.texpaint_material) - ima = ma->texpaintslot ? ma->texpaintslot[ma->paint_active_slot].ima : NULL; - else + ima = ma && ma->texpaintslot ? ma->texpaintslot[ma->paint_active_slot].ima : NULL; + else ima = gtexdraw.canvas; } else @@ -315,6 +315,14 @@ static bool set_draw_settings_cached(int clearcache, MTFace *texface, Material * glActiveTexture(GL_TEXTURE1); glEnable(GL_TEXTURE_2D); + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); + glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_INTERPOLATE); + glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_PREVIOUS); + glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_PRIMARY_COLOR); + glTexEnvi(GL_TEXTURE_ENV, GL_SRC2_RGB, GL_PREVIOUS); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_ALPHA); + glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE); + glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_PREVIOUS); glBindTexture(GL_TEXTURE_2D, ima->bindcode); glActiveTexture(GL_TEXTURE0); } diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index e7b6e50ef1c..d155918f7f9 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -302,7 +302,8 @@ bool draw_glsl_material(Scene *scene, Object *ob, View3D *v3d, const char dt) if (BKE_scene_use_new_shading_nodes(scene)) return false; - return ((scene->gm.matmode == GAME_MAT_GLSL) || (v3d->drawtype == OB_MATERIAL)) && (dt > OB_SOLID); + return ((scene->gm.matmode == GAME_MAT_GLSL && v3d->drawtype == OB_TEXTURE) || + (v3d->drawtype == OB_MATERIAL)) && (dt > OB_SOLID); } static bool check_alpha_pass(Base *base) @@ -5181,7 +5182,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv /* restore & clean up */ if (1) { //ob_dt > OB_WIRE) { if (part->draw_col == PART_DRAW_COL_MAT) - glDisable(GL_COLOR_ARRAY); + glDisableClientState(GL_COLOR_ARRAY); glDisable(GL_COLOR_MATERIAL); } diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 8b76ec3a56d..0e3621aa91f 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -698,10 +698,6 @@ static void view3d_main_area_free(ARegion *ar) if (rv3d->localvd) MEM_freeN(rv3d->localvd); if (rv3d->clipbb) MEM_freeN(rv3d->clipbb); - if (rv3d->ri) { - // XXX BIF_view3d_previewrender_free(rv3d); - } - if (rv3d->render_engine) RE_engine_free(rv3d->render_engine); @@ -735,7 +731,6 @@ static void *view3d_main_area_duplicate(void *poin) new->depths = NULL; new->gpuoffscreen = NULL; - new->ri = NULL; new->render_engine = NULL; new->sms = NULL; new->smooth_timer = NULL; diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 004b3e1b7d3..61bfb0176ef 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1091,6 +1091,9 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) /* passepartout, specified in camera edit buttons */ if (ca && (ca->flag & CAM_SHOWPASSEPARTOUT) && ca->passepartalpha > 0.000001f) { + const float winx = (ar->winx + 1); + const float winy = (ar->winy + 1); + if (ca->passepartalpha == 1.0f) { glColor3f(0, 0, 0); } @@ -1100,11 +1103,11 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) glColor4f(0, 0, 0, ca->passepartalpha); } if (x1i > 0.0f) - glRectf(0.0, (float)ar->winy, x1i, 0.0); - if (x2i < (float)ar->winx) - glRectf(x2i, (float)ar->winy, (float)ar->winx, 0.0); - if (y2i < (float)ar->winy) - glRectf(x1i, (float)ar->winy, x2i, y2i); + glRectf(0.0, winy, x1i, 0.0); + if (x2i < winx) + glRectf(x2i, winy, winx, 0.0); + if (y2i < winy) + glRectf(x1i, winy, x2i, y2i); if (y2i > 0.0f) glRectf(x1i, y1i, x2i, 0.0); @@ -1585,6 +1588,7 @@ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d, int fg_flag = do_foreground ? V3D_BGPIC_FOREGROUND : 0; for (bgpic = v3d->bgpicbase.first; bgpic; bgpic = bgpic->next) { + bgpic->iuser.scene = scene; /* Needed for render results. */ if ((bgpic->flag & V3D_BGPIC_FOREGROUND) != fg_flag) continue; @@ -1598,9 +1602,10 @@ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d, float x1, y1, x2, y2; ImBuf *ibuf = NULL, *freeibuf, *releaseibuf; + void *lock; - Image *ima; - MovieClip *clip; + Image *ima = NULL; + MovieClip *clip = NULL; /* disable individual images */ if ((bgpic->flag & V3D_BGPIC_DISABLED)) @@ -1617,16 +1622,14 @@ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d, ibuf = NULL; /* frame is out of range, dont show */ } else { - ibuf = BKE_image_acquire_ibuf(ima, &bgpic->iuser, NULL); + ibuf = BKE_image_acquire_ibuf(ima, &bgpic->iuser, &lock); releaseibuf = ibuf; } image_aspect[0] = ima->aspx; - image_aspect[1] = ima->aspx; + image_aspect[1] = ima->aspy; } else if (bgpic->source == V3D_BGPIC_MOVIE) { - clip = NULL; - /* TODO: skip drawing when out of frame range (as image sequences do above) */ if (bgpic->flag & V3D_BGPIC_CAMERACLIP) { @@ -1664,7 +1667,7 @@ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d, if (freeibuf) IMB_freeImBuf(freeibuf); if (releaseibuf) - BKE_image_release_ibuf(ima, releaseibuf, NULL); + BKE_image_release_ibuf(ima, releaseibuf, lock); continue; } @@ -1763,7 +1766,7 @@ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d, if (freeibuf) IMB_freeImBuf(freeibuf); if (releaseibuf) - BKE_image_release_ibuf(ima, releaseibuf, NULL); + BKE_image_release_ibuf(ima, releaseibuf, lock); continue; } @@ -1830,7 +1833,7 @@ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d, if (freeibuf) IMB_freeImBuf(freeibuf); if (releaseibuf) - BKE_image_release_ibuf(ima, releaseibuf, NULL); + BKE_image_release_ibuf(ima, releaseibuf, lock); } } } @@ -1981,8 +1984,10 @@ static void draw_dupli_objects_color( GLuint displist = 0; unsigned char color_rgb[3]; const short dflag_dupli = dflag | DRAW_CONSTCOLOR; - short transflag, use_displist = -1; /* -1 is initialize */ + short transflag; + bool use_displist = false; /* -1 is initialize */ char dt; + bool testbb = false; short dtx; DupliApplyData *apply_data; @@ -2037,71 +2042,77 @@ static void draw_dupli_objects_color( tbase.object->transflag |= OB_NEG_SCALE; else tbase.object->transflag &= ~OB_NEG_SCALE; - + /* should move outside the loop but possible color is set in draw_object still */ if ((dflag & DRAW_CONSTCOLOR) == 0) { glColor3ubv(color_rgb); } - + /* generate displist, test for new object */ if (dob_prev && dob_prev->ob != dob->ob) { if (use_displist == true) glDeleteLists(displist, 1); - - use_displist = -1; + + use_displist = false; + } + + if ((bb_tmp = BKE_object_boundbox_get(dob->ob))) { + bb = *bb_tmp; /* must make a copy */ + testbb = true; } - /* generate displist */ - if (use_displist == -1) { - - /* note, since this was added, its checked (dob->type == OB_DUPLIGROUP) - * however this is very slow, it was probably needed for the NLA - * offset feature (used in group-duplicate.blend but no longer works in 2.5) - * so for now it should be ok to - campbell */ - - if ( /* if this is the last no need to make a displist */ - (dob_next == NULL || dob_next->ob != dob->ob) || - /* lamp drawing messes with matrices, could be handled smarter... but this works */ - (dob->ob->type == OB_LAMP) || - (dob->type == OB_DUPLIGROUP && dob->animated) || - !(bb_tmp = BKE_object_boundbox_get(dob->ob)) || - draw_glsl_material(scene, dob->ob, v3d, dt) || - check_object_draw_texture(scene, v3d, dt) || - (base->object == OBACT && v3d->flag2 & V3D_SOLID_MATCAP)) - { - // printf("draw_dupli_objects_color: skipping displist for %s\n", dob->ob->id.name + 2); - use_displist = false; - } - else { - // printf("draw_dupli_objects_color: using displist for %s\n", dob->ob->id.name + 2); - bb = *bb_tmp; /* must make a copy */ - - /* disable boundbox check for list creation */ - BKE_object_boundbox_flag(dob->ob, BOUNDBOX_DISABLED, 1); - /* need this for next part of code */ - unit_m4(dob->ob->obmat); /* obmat gets restored */ - - displist = glGenLists(1); - glNewList(displist, GL_COMPILE); - draw_object(scene, ar, v3d, &tbase, dflag_dupli); - glEndList(); - - use_displist = true; - BKE_object_boundbox_flag(dob->ob, BOUNDBOX_DISABLED, 0); + if (!testbb || ED_view3d_boundbox_clip_ex(rv3d, &bb, dob->mat)) { + /* generate displist */ + if (use_displist == false) { + + /* note, since this was added, its checked (dob->type == OB_DUPLIGROUP) + * however this is very slow, it was probably needed for the NLA + * offset feature (used in group-duplicate.blend but no longer works in 2.5) + * so for now it should be ok to - campbell */ + + if ( /* if this is the last no need to make a displist */ + (dob_next == NULL || dob_next->ob != dob->ob) || + /* lamp drawing messes with matrices, could be handled smarter... but this works */ + (dob->ob->type == OB_LAMP) || + (dob->type == OB_DUPLIGROUP && dob->animated) || + !bb_tmp || + draw_glsl_material(scene, dob->ob, v3d, dt) || + check_object_draw_texture(scene, v3d, dt) || + (v3d->flag2 & V3D_SOLID_MATCAP) != 0) + { + // printf("draw_dupli_objects_color: skipping displist for %s\n", dob->ob->id.name + 2); + use_displist = false; + } + else { + // printf("draw_dupli_objects_color: using displist for %s\n", dob->ob->id.name + 2); + + /* disable boundbox check for list creation */ + BKE_object_boundbox_flag(dob->ob, BOUNDBOX_DISABLED, 1); + /* need this for next part of code */ + unit_m4(dob->ob->obmat); /* obmat gets restored */ + + displist = glGenLists(1); + glNewList(displist, GL_COMPILE); + draw_object(scene, ar, v3d, &tbase, dflag_dupli); + glEndList(); + + use_displist = true; + BKE_object_boundbox_flag(dob->ob, BOUNDBOX_DISABLED, 0); + } } - } - if (use_displist) { - if (ED_view3d_boundbox_clip_ex(rv3d, &bb, dob->mat)) { + + if (use_displist) { + glPushMatrix(); glMultMatrixf(dob->mat); glCallList(displist); - glLoadMatrixf(rv3d->viewmat); + glPopMatrix(); + } + else { + copy_m4_m4(dob->ob->obmat, dob->mat); + draw_object(scene, ar, v3d, &tbase, dflag_dupli); } } - else { - copy_m4_m4(dob->ob->obmat, dob->mat); - draw_object(scene, ar, v3d, &tbase, dflag_dupli); - } - + tbase.object->dt = dt; tbase.object->dtx = dtx; tbase.object->transflag = transflag; @@ -2473,7 +2484,7 @@ static void gpu_update_lamps_shadows(Scene *scene, View3D *v3d) v3d->drawtype = OB_SOLID; v3d->lay &= GPU_lamp_shadow_layer(shadow->lamp); - v3d->flag2 &= ~V3D_SOLID_TEX | V3D_SHOW_SOLID_MATCAP; + v3d->flag2 &= ~(V3D_SOLID_TEX | V3D_SHOW_SOLID_MATCAP); v3d->flag2 |= V3D_RENDER_OVERRIDE | V3D_RENDER_SHADOW; GPU_lamp_shadow_buffer_bind(shadow->lamp, viewmat, &winsize, winmat); @@ -2515,8 +2526,11 @@ CustomDataMask ED_view3d_datamask(Scene *scene, View3D *v3d) mask |= CD_MASK_ORCO; } else { - if (scene->gm.matmode == GAME_MAT_GLSL || v3d->drawtype == OB_MATERIAL) + if ((scene->gm.matmode == GAME_MAT_GLSL && v3d->drawtype == OB_TEXTURE) || + (v3d->drawtype == OB_MATERIAL)) + { mask |= CD_MASK_ORCO; + } } } diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index db675b09896..f54e7ae06f6 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -1037,8 +1037,8 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y) * - dragged. */ phi = si * (float)(M_PI / 2.0); - q1[0] = cos(phi); - mul_v3_fl(q1 + 1, sin(phi)); + q1[0] = cosf(phi); + mul_v3_fl(q1 + 1, sinf(phi)); mul_qt_qtqt(vod->viewquat, q1, vod->oldquat); viewrotate_apply_dyn_ofs(vod, vod->viewquat); @@ -1448,7 +1448,7 @@ static void view3d_ndof_orbit(const struct wmNDOFMotionData *ndof, ScrArea *sa, /* Perform the up/down rotation */ angle = ndof->dt * rot[0]; quat[0] = cosf(angle); - mul_v3_v3fl(quat + 1, xvec, sin(angle)); + mul_v3_v3fl(quat + 1, xvec, sinf(angle)); mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, quat); /* Perform the orbital rotation */ @@ -3423,7 +3423,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op) /* find the closest Z pixel */ depth_close = view3d_depth_near(&depth_temp); - MEM_freeN(depth_temp.depths); + MEM_SAFE_FREE(depth_temp.depths); } cent[0] = (((double)rect.xmin) + ((double)rect.xmax)) / 2; @@ -4640,7 +4640,7 @@ static float view_autodist_depth_margin(ARegion *ar, const int mval[2], int marg view3d_update_depths_rect(ar, &depth_temp, &rect); depth_close = view3d_depth_near(&depth_temp); - if (depth_temp.depths) MEM_freeN(depth_temp.depths); + MEM_SAFE_FREE(depth_temp.depths); return depth_close; } diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 46ea52054c5..ae429289ffd 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -1181,14 +1181,14 @@ static short selectbuffer_ret_hits_15(unsigned int *UNUSED(buffer), const short static short selectbuffer_ret_hits_9(unsigned int *buffer, const short hits15, const short hits9) { const int offs = 4 * hits15; - memcpy(buffer, buffer + offs, 4 * offs); + memcpy(buffer, buffer + offs, 4 * hits9); return hits9; } static short selectbuffer_ret_hits_5(unsigned int *buffer, const short hits15, const short hits9, const short hits5) { const int offs = 4 * hits15 + 4 * hits9; - memcpy(buffer, buffer + offs, 4 * offs); + memcpy(buffer, buffer + offs, 4 * hits5); return hits5; } @@ -1522,7 +1522,7 @@ static bool mouse_select(bContext *C, const int mval[2], } } } - else if (ED_do_pose_selectbuffer(scene, basact, buffer, hits, extend, deselect, toggle) ) { + else if (ED_do_pose_selectbuffer(scene, basact, buffer, hits, extend, deselect, toggle, do_nearest)) { /* then bone is found */ /* we make the armature selected: @@ -1972,7 +1972,7 @@ static int do_armature_box_select(ViewContext *vc, rcti *rect, bool select, bool ED_armature_sync_selection(arm->edbo); - return OPERATOR_CANCELLED; + return hits > 0 ? OPERATOR_FINISHED : OPERATOR_CANCELLED; } static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, bool select, bool extend) diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c index 7bdf39d6768..c54948b23c6 100644 --- a/source/blender/editors/space_view3d/view3d_walk.c +++ b/source/blender/editors/space_view3d/view3d_walk.c @@ -961,7 +961,7 @@ static int walkApply(bContext *C, WalkInfo *walk) /* clamp the angle limits */ /* it ranges from 90.0f to -90.0f */ - angle = -asin(rv3d->viewmat[2][2]); + angle = -asinf(rv3d->viewmat[2][2]); if (angle > WALK_TOP_LIMIT && y > 0.0f) y = 0.0f; diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 008022a9859..24499688835 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -58,6 +58,7 @@ #include "BKE_particle.h" #include "BKE_unit.h" #include "BKE_mask.h" +#include "BKE_report.h" #include "BIF_gl.h" #include "BIF_glutil.h" @@ -270,7 +271,8 @@ void convertViewVec(TransInfo *t, float r_vec[3], int dx, int dy) r_vec[0] = dx; r_vec[1] = dy; } - else { const float mval_f[2] = {(float)dx, (float)dy}; + else { + const float mval_f[2] = {(float)dx, (float)dy}; ED_view3d_win_to_delta(t->ar, mval_f, r_vec, t->zfac); } } @@ -2053,7 +2055,6 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve initTransInfo(C, t, op, event); if (t->spacetype == SPACE_VIEW3D) { - //calc_manipulator_stats(curarea); initTransformOrientation(C, t); t->draw_handle_apply = ED_region_draw_cb_activate(t->ar->type, drawTransformApply, t, REGION_DRAW_PRE_VIEW); @@ -4066,6 +4067,9 @@ static void initTranslation(TransInfo *t) { if (t->spacetype == SPACE_ACTION) { /* this space uses time translate */ + BKE_report(t->reports, RPT_ERROR, + "Use 'Time_Translate' transform mode instead of 'Translation' mode " + "for translating keyframes in Dope Sheet Editor"); t->state = TRANS_CANCEL; } diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index 012f9185d8b..67d55639528 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -537,7 +537,6 @@ void restoreBones(TransInfo *t); /*********************** exported from transform_manipulator.c ********** */ bool gimbal_axis(struct Object *ob, float gmat[3][3]); /* return 0 when no gimbal for selection */ -int calc_manipulator_stats(const struct bContext *C); /*********************** TransData Creation and General Handling *********** */ void createTransData(struct bContext *C, TransInfo *t); diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index aa215613841..47adbb6d16d 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -1711,7 +1711,9 @@ static void createTransLatticeVerts(TransInfo *t) if (bp->f1 & SELECT) { td->flag = TD_SELECTED; } - else td->flag = 0; + else { + td->flag = 0; + } copy_m3_m3(td->smtx, smtx); copy_m3_m3(td->mtx, mtx); @@ -3068,10 +3070,10 @@ static void createTransNlaData(bContext *C, TransInfo *t) /* ********************* ACTION EDITOR ****************** */ -static int gpf_cmp_frame(void *thunk, void *a, void *b) +static int gpf_cmp_frame(void *thunk, const void *a, const void *b) { - bGPDframe *frame_a = a; - bGPDframe *frame_b = b; + const bGPDframe *frame_a = a; + const bGPDframe *frame_b = b; if (frame_a->framenum < frame_b->framenum) return -1; if (frame_a->framenum > frame_b->framenum) return 1; @@ -3085,10 +3087,10 @@ static int gpf_cmp_frame(void *thunk, void *a, void *b) return 0; } -static int masklay_shape_cmp_frame(void *thunk, void *a, void *b) +static int masklay_shape_cmp_frame(void *thunk, const void *a, const void *b) { - MaskLayerShape *frame_a = a; - MaskLayerShape *frame_b = b; + const MaskLayerShape *frame_a = a; + const MaskLayerShape *frame_b = b; if (frame_a->frame < frame_b->frame) return -1; if (frame_a->frame > frame_b->frame) return 1; diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index 2161e52d7b2..37a6d50e149 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -262,7 +262,7 @@ bool gimbal_axis(Object *ob, float gmat[3][3]) /* centroid, boundbox, of selection */ /* returns total items selected */ -int calc_manipulator_stats(const bContext *C) +static int calc_manipulator_stats(const bContext *C) { ScrArea *sa = CTX_wm_area(C); ARegion *ar = CTX_wm_region(C); diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index abef2c9fc30..af563f71376 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -872,9 +872,9 @@ static float RotationBetween(TransInfo *t, const float p1[3], const float p2[3]) cross_v3_v3v3(tmp, start, end); if (dot_v3v3(tmp, axis) < 0.0f) - angle = -acos(dot_v3v3(start, end)); + angle = -acosf(dot_v3v3(start, end)); else - angle = acos(dot_v3v3(start, end)); + angle = acosf(dot_v3v3(start, end)); } else { float mtx[3][3]; @@ -884,7 +884,7 @@ static float RotationBetween(TransInfo *t, const float p1[3], const float p2[3]) mul_m3_v3(mtx, end); mul_m3_v3(mtx, start); - angle = atan2(start[1], start[0]) - atan2(end[1], end[0]); + angle = atan2f(start[1], start[0]) - atan2f(end[1], end[0]); } if (angle > (float)M_PI) { @@ -2036,10 +2036,10 @@ bool snapObjectsRayEx(Scene *scene, Base *base_act, View3D *v3d, ARegion *ar, Ob /******************** PEELING *********************************/ -static int cmpPeel(void *arg1, void *arg2) +static int cmpPeel(const void *arg1, const void *arg2) { - DepthPeel *p1 = arg1; - DepthPeel *p2 = arg2; + const DepthPeel *p1 = arg1; + const DepthPeel *p2 = arg2; int val = 0; if (p1->depth < p2->depth) { diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index 36c96a8d011..83fd7e6505d 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -946,14 +946,30 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit) glPointSize(1.0); } + +static void draw_uv_shadows_get(SpaceImage *sima, Object *ob, Object *obedit, bool *show_shadow, bool *show_texpaint) +{ + *show_shadow = *show_texpaint = false; + + if (ED_space_image_show_render(sima) || (sima->flag & SI_NO_DRAW_TEXPAINT)) + return; + + if ((sima->mode == SI_MODE_PAINT) && obedit && obedit->type == OB_MESH) { + struct BMEditMesh *em = BKE_editmesh_from_object(obedit); + + *show_shadow = EDBM_mtexpoly_check(em); + } + + *show_texpaint = (ob && ob->type == OB_MESH && ob->mode == OB_MODE_TEXTURE_PAINT); +} + void draw_uvedit_main(SpaceImage *sima, ARegion *ar, Scene *scene, Object *obedit, Object *obact) { ToolSettings *toolsettings = scene->toolsettings; - int show_uvedit, show_uvshadow, show_texpaint_uvshadow; + bool show_uvedit, show_uvshadow, show_texpaint_uvshadow; - show_texpaint_uvshadow = ED_space_image_show_texpaint(sima, obact); show_uvedit = ED_space_image_show_uvedit(sima, obedit); - show_uvshadow = ED_space_image_show_uvshadow(sima, obedit); + draw_uv_shadows_get(sima, obact, obedit, &show_uvshadow, &show_texpaint_uvshadow); if (show_uvedit || show_uvshadow || show_texpaint_uvshadow) { if (show_uvshadow) diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index 5f22a201600..79f53e1d971 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -372,7 +372,7 @@ static float p_vec_angle(float *v1, float *v2, float *v3) else if (dot >= 1.0f) return 0.0f; else - return (float)acos(dot); + return acosf(dot); } static float p_vec2_angle(float *v1, float *v2, float *v3) @@ -433,7 +433,7 @@ static float p_edge_length(PEdge *e) d[1] = v2->co[1] - v1->co[1]; d[2] = v2->co[2] - v1->co[2]; - return sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]); + return sqrtf(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]); } static float p_edge_uv_length(PEdge *e) @@ -444,7 +444,7 @@ static float p_edge_uv_length(PEdge *e) d[0] = v2->uv[0] - v1->uv[0]; d[1] = v2->uv[1] - v1->uv[1]; - return sqrt(d[0] * d[0] + d[1] * d[1]); + return sqrtf(d[0] * d[0] + d[1] * d[1]); } static void p_chart_uv_bbox(PChart *chart, float minv[2], float maxv[2]) @@ -2353,8 +2353,8 @@ static void p_abf_compute_sines(PAbfSystem *sys) float *sine = sys->sine, *cosine = sys->cosine, *alpha = sys->alpha; for (i = 0; i < sys->nangles; i++, sine++, cosine++, alpha++) { - *sine = sin(*alpha); - *cosine = cos(*alpha); + *sine = sinf(*alpha); + *cosine = cosf(*alpha); } } @@ -3163,9 +3163,9 @@ static PBool p_chart_lscm_solve(PHandle *handle, PChart *chart) SWAP(PVert *, v2, v3); } - sina1 = sin(a1); - sina2 = sin(a2); - sina3 = sin(a3); + sina1 = sinf(a1); + sina2 = sinf(a2); + sina3 = sinf(a3); sinmax = max_fff(sina1, sina2, sina3); @@ -3314,7 +3314,7 @@ static float p_face_stretch(PFace *f) a = dot_v3v3(Ps, Ps); c = dot_v3v3(Pt, Pt); - T = sqrt(0.5f * (a + c)); + T = sqrtf(0.5f * (a + c)); if (f->flag & PFACE_FILLED) T *= 0.2f; @@ -3630,8 +3630,8 @@ static float p_chart_minimum_area_angle(PChart *chart) static void p_chart_rotate_minimum_area(PChart *chart) { float angle = p_chart_minimum_area_angle(chart); - float sine = sin(angle); - float cosine = cos(angle); + float sine = sinf(angle); + float cosine = cosf(angle); PVert *v; for (v = chart->verts; v; v = v->nextlink) { @@ -4045,7 +4045,7 @@ static void p_smooth(PChart *chart) diff[0] = p[0] - oldp[0]; diff[1] = p[1] - oldp[1]; - length = sqrt(diff[0] * diff[0] + diff[1] * diff[1]); + length = len_v2(diff); d = max_ff(d, length); moved += length; } @@ -4559,7 +4559,7 @@ void param_pack(ParamHandle *handle, float margin, bool do_rotate) box->index = i; /* warning this index skips PCHART_NOPACK boxes */ if (margin > 0.0f) - area += sqrt(box->w * box->h); + area += sqrtf(box->w * box->h); } if (margin > 0.0f) { @@ -4661,7 +4661,7 @@ void param_average(ParamHandle *handle) /* Move center to 0,0 */ p_chart_uv_translate(chart, trans); - p_chart_uv_scale(chart, sqrt(fac / tot_fac)); + p_chart_uv_scale(chart, sqrtf(fac / tot_fac)); /* Move to original center */ trans[0] = -trans[0]; diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c index ba4b65f4ed4..fcd5267fd44 100644 --- a/source/blender/editors/uvedit/uvedit_smart_stitch.c +++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c @@ -1360,7 +1360,7 @@ static unsigned int uv_edge_hash(const void *key) BLI_ghashutil_uinthash(edge->uv1); } -static int uv_edge_compare(const void *a, const void *b) +static bool uv_edge_compare(const void *a, const void *b) { UvEdge *edge1 = (UvEdge *)a; UvEdge *edge2 = (UvEdge *)b; diff --git a/source/blender/freestyle/CMakeLists.txt b/source/blender/freestyle/CMakeLists.txt index c94a5ac9f92..bfd1c17df7d 100644 --- a/source/blender/freestyle/CMakeLists.txt +++ b/source/blender/freestyle/CMakeLists.txt @@ -412,6 +412,8 @@ set(SRC intern/scene_graph/OrientedLineRep.h intern/scene_graph/Rep.cpp intern/scene_graph/Rep.h + intern/scene_graph/SceneHash.cpp + intern/scene_graph/SceneHash.h intern/scene_graph/ScenePrettyPrinter.cpp intern/scene_graph/ScenePrettyPrinter.h intern/scene_graph/SceneVisitor.cpp diff --git a/source/blender/freestyle/FRS_freestyle.h b/source/blender/freestyle/FRS_freestyle.h index fc9fc35e410..9766372507b 100644 --- a/source/blender/freestyle/FRS_freestyle.h +++ b/source/blender/freestyle/FRS_freestyle.h @@ -48,6 +48,7 @@ int FRS_is_freestyle_enabled(struct SceneRenderLayer *srl); void FRS_init_stroke_rendering(struct Render *re); struct Render *FRS_do_stroke_rendering(struct Render *re, struct SceneRenderLayer *srl, int render); void FRS_finish_stroke_rendering(struct Render *re); +void FRS_free_view_map_cache(void); void FRS_composite_result(struct Render *re, struct SceneRenderLayer *srl, struct Render *freestyle_render); void FRS_exit(void); diff --git a/source/blender/freestyle/intern/application/Controller.cpp b/source/blender/freestyle/intern/application/Controller.cpp index 176199600ac..7ecb4164caf 100644 --- a/source/blender/freestyle/intern/application/Controller.cpp +++ b/source/blender/freestyle/intern/application/Controller.cpp @@ -118,6 +118,7 @@ Controller::Controller() _Canvas = new AppCanvas; _inter = new PythonInterpreter(); + _EnableViewMapCache = false; _EnableQI = true; _EnableFaceSmoothness = false; _ComputeRidges = true; @@ -126,6 +127,7 @@ Controller::Controller() _ComputeMaterialBoundaries = true; _sphereRadius = 1.0; _creaseAngle = 134.43; + prevSceneHash = -1.0; init_options(); } @@ -212,6 +214,19 @@ void Controller::setContext(bContext *C) py_inter->setContext(C); } +bool Controller::hitViewMapCache() +{ + if (!_EnableViewMapCache) { + return false; + } + real hashCode = sceneHashFunc.getValue(); + if (prevSceneHash == hashCode) { + return (NULL != _ViewMap); + } + prevSceneHash = hashCode; + return false; +} + int Controller::LoadMesh(Render *re, SceneRenderLayer *srl) { BlenderFileLoader loader(re, srl); @@ -242,6 +257,7 @@ int Controller::LoadMesh(Render *re, SceneRenderLayer *srl) if (G.debug & G_DEBUG_FREESTYLE) { cout << "Scene loaded" << endl; printf("Mesh cleaning : %lf\n", duration); + printf("View map cache : %s\n", _EnableViewMapCache ? "enabled" : "disabled"); } _SceneNumFaces += loader.numFacesRead(); @@ -263,6 +279,22 @@ int Controller::LoadMesh(Render *re, SceneRenderLayer *srl) if (_pRenderMonitor->testBreak()) return 0; + if (_EnableViewMapCache) { + sceneHashFunc.reset(); + blenderScene->accept(sceneHashFunc); + if (G.debug & G_DEBUG_FREESTYLE) { + printf("Scene hash : %.16e\n", sceneHashFunc.getValue()); + } + if (hitViewMapCache()) { + ClearRootNode(); + return 0; + } + else { + delete _ViewMap; + _ViewMap = NULL; + } + } + _Chrono.start(); WXEdgeBuilder wx_builder; @@ -357,7 +389,7 @@ void Controller::DeleteWingedEdge() _minEdgeSize = DBL_MAX; } -void Controller::DeleteViewMap() +void Controller::DeleteViewMap(bool freeCache) { _pView->DetachSilhouette(); if (NULL != _SilhouetteNode) { @@ -387,14 +419,20 @@ void Controller::DeleteViewMap() _pView->DetachDebug(); if (NULL != _DebugNode) { - int ref = _DebugNode->destroy(); + int ref = _DebugNode->destroy(); if (0 == ref) _DebugNode->addRef(); } if (NULL != _ViewMap) { - delete _ViewMap; - _ViewMap = NULL; + if (freeCache || !_EnableViewMapCache) { + delete _ViewMap; + _ViewMap = NULL; + prevSceneHash = -1.0; + } + else { + _ViewMap->Clean(); + } } } @@ -403,40 +441,7 @@ void Controller::ComputeViewMap() if (!_ListOfModels.size()) return; - if (NULL != _ViewMap) { - delete _ViewMap; - _ViewMap = NULL; - } - - _pView->DetachDebug(); - if (NULL != _DebugNode) { - int ref = _DebugNode->destroy(); - if (0 == ref) - _DebugNode->addRef(); - } - - _pView->DetachSilhouette(); - if (NULL != _SilhouetteNode) { - int ref = _SilhouetteNode->destroy(); - if (0 == ref) - delete _SilhouetteNode; - } - -#if 0 - if (NULL != _ProjectedSilhouette) { - int ref = _ProjectedSilhouette->destroy(); - if (0 == ref) - delete _ProjectedSilhouette; - } - - if (NULL != _VisibleProjectedSilhouette) { - int ref = _VisibleProjectedSilhouette->destroy(); - if (0 == ref) { - delete _VisibleProjectedSilhouette; - _VisibleProjectedSilhouette = NULL; - } - } -#endif + DeleteViewMap(true); // retrieve the 3D viewpoint and transformations information //---------------------------------------------------------- @@ -763,6 +768,16 @@ int Controller::getVisibilityAlgo() return FREESTYLE_ALGO_ADAPTIVE_TRADITIONAL; } +void Controller::setViewMapCache(bool iBool) +{ + _EnableViewMapCache = iBool; +} + +bool Controller::getViewMapCache() const +{ + return _EnableViewMapCache; +} + void Controller::setQuantitativeInvisibility(bool iBool) { _EnableQI = iBool; diff --git a/source/blender/freestyle/intern/application/Controller.h b/source/blender/freestyle/intern/application/Controller.h index f5e50347d0f..9fe57d92cf4 100644 --- a/source/blender/freestyle/intern/application/Controller.h +++ b/source/blender/freestyle/intern/application/Controller.h @@ -32,6 +32,7 @@ //#include "ConfigIO.h" #include "../geometry/FastGrid.h" +#include "../scene_graph/SceneHash.h" #include "../system/Interpreter.h" #include "../system/ProgressBar.h" #include "../system/Precision.h" @@ -96,7 +97,7 @@ public: void Clear(); void ClearRootNode(); void DeleteWingedEdge(); - void DeleteViewMap(); + void DeleteViewMap(bool freeCache = false); void toggleLayer(unsigned index, bool iDisplay); void setModified(unsigned index, bool iMod); void resetModified(bool iMod=false); @@ -118,6 +119,8 @@ public: void setVisibilityAlgo(int algo); int getVisibilityAlgo(); + void setViewMapCache(bool iBool); + bool getViewMapCache() const; void setQuantitativeInvisibility(bool iBool); // if true, we compute quantitativeInvisibility bool getQuantitativeInvisibility() const; void setFaceSmoothness(bool iBool); @@ -144,6 +147,8 @@ public: void setModulesDir(const string& dir); string getModulesDir() const; + bool hitViewMapCache(); + void resetInterpreter(); public: @@ -231,6 +236,7 @@ private: string _help_index; string _browser_cmd; + bool _EnableViewMapCache; bool _EnableQI; bool _EnableFaceSmoothness; bool _ComputeRidges; @@ -244,6 +250,9 @@ private: FEdgeXDetector edgeDetector; + SceneHash sceneHashFunc; + real prevSceneHash; + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Controller") #endif diff --git a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp index 32f49d48ee7..4dd4598cc91 100644 --- a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp +++ b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp @@ -474,6 +474,9 @@ static void prepare(Main *bmain, Render *re, SceneRenderLayer *srl) cout << " Z = " << (z ? "enabled" : "disabled") << endl; } + if (controller->hitViewMapCache()) + return; + // compute view map re->i.infostr = "Freestyle: View map creation"; re->stats_draw(re->sdh, &re->i); @@ -589,6 +592,7 @@ Render *FRS_do_stroke_rendering(Render *re, SceneRenderLayer *srl, int render) RenderMonitor monitor(re); controller->setRenderMonitor(&monitor); + controller->setViewMapCache((srl->freestyleConfig.flags & FREESTYLE_VIEW_MAP_CACHE) ? true : false); if (G.debug & G_DEBUG_FREESTYLE) { cout << endl; @@ -647,6 +651,17 @@ void FRS_finish_stroke_rendering(Render *re) controller->Clear(); } +void FRS_free_view_map_cache(void) +{ + // free cache + controller->DeleteViewMap(true); +#if 0 + if (G.debug & G_DEBUG_FREESTYLE) { + printf("View map cache freed\n"); + } +#endif +} + //======================================================= // Freestyle Panel Configuration //======================================================= diff --git a/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp b/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp index 15cc4c3a0b0..4d0d140474a 100644 --- a/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp +++ b/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp @@ -80,9 +80,9 @@ PyDoc_STRVAR(FrsMaterial_doc, " :arg emission: The emissive color.\n" " :type emission: :class:`mathutils.Vector`, list or tuple of 4 float values\n" " :arg shininess: The shininess coefficient.\n" -" :type shininess: :class:float\n" +" :type shininess: float\n" " :arg priority: The line color priority.\n" -" :type priority: :class:int"); +" :type priority: int"); static int FrsMaterial_init(BPy_FrsMaterial *self, PyObject *args, PyObject *kwds) { @@ -311,7 +311,7 @@ void FrsMaterial_mathutils_register_callback() PyDoc_STRVAR(FrsMaterial_line_doc, "RGBA components of the line color of the material.\n" "\n" -":type: mathutils.Vector"); +":type: :class:`mathutils.Vector`"); static PyObject *FrsMaterial_line_get(BPy_FrsMaterial *self, void *UNUSED(closure)) { @@ -333,7 +333,7 @@ static int FrsMaterial_line_set(BPy_FrsMaterial *self, PyObject *value, void *UN PyDoc_STRVAR(FrsMaterial_diffuse_doc, "RGBA components of the diffuse color of the material.\n" "\n" -":type: mathutils.Vector"); +":type: :class:`mathutils.Vector`"); static PyObject *FrsMaterial_diffuse_get(BPy_FrsMaterial *self, void *UNUSED(closure)) { @@ -355,7 +355,7 @@ static int FrsMaterial_diffuse_set(BPy_FrsMaterial *self, PyObject *value, void PyDoc_STRVAR(FrsMaterial_specular_doc, "RGBA components of the specular color of the material.\n" "\n" -":type: mathutils.Vector"); +":type: :class:`mathutils.Vector`"); static PyObject *FrsMaterial_specular_get(BPy_FrsMaterial *self, void *UNUSED(closure)) { @@ -377,7 +377,7 @@ static int FrsMaterial_specular_set(BPy_FrsMaterial *self, PyObject *value, void PyDoc_STRVAR(FrsMaterial_ambient_doc, "RGBA components of the ambient color of the material.\n" "\n" -":type: mathutils.Color"); +":type: :class:`mathutils.Color`"); static PyObject *FrsMaterial_ambient_get(BPy_FrsMaterial *self, void *UNUSED(closure)) { @@ -399,7 +399,7 @@ static int FrsMaterial_ambient_set(BPy_FrsMaterial *self, PyObject *value, void PyDoc_STRVAR(FrsMaterial_emission_doc, "RGBA components of the emissive color of the material.\n" "\n" -":type: mathutils.Color"); +":type: :class:`mathutils.Color`"); static PyObject *FrsMaterial_emission_get(BPy_FrsMaterial *self, void *UNUSED(closure)) { diff --git a/source/blender/freestyle/intern/python/BPy_Interface0D.cpp b/source/blender/freestyle/intern/python/BPy_Interface0D.cpp index 9355c9cd677..8f23800fb7a 100644 --- a/source/blender/freestyle/intern/python/BPy_Interface0D.cpp +++ b/source/blender/freestyle/intern/python/BPy_Interface0D.cpp @@ -165,7 +165,7 @@ static PyObject *Interface0D_name_get(BPy_Interface0D *self, void *UNUSED(closur PyDoc_STRVAR(Interface0D_point_3d_doc, "The 3D point of this 0D element.\n" "\n" -":type: mathutils.Vector"); +":type: :class:`mathutils.Vector`"); static PyObject *Interface0D_point_3d_get(BPy_Interface0D *self, void *UNUSED(closure)) { @@ -217,7 +217,7 @@ static PyObject *Interface0D_projected_z_get(BPy_Interface0D *self, void *UNUSED PyDoc_STRVAR(Interface0D_point_2d_doc, "The 2D point of this 0D element.\n" "\n" -":type: mathutils.Vector"); +":type: :class:`mathutils.Vector`"); static PyObject *Interface0D_point_2d_get(BPy_Interface0D *self, void *UNUSED(closure)) { diff --git a/source/blender/freestyle/intern/python/BPy_Operators.cpp b/source/blender/freestyle/intern/python/BPy_Operators.cpp index 123fbab7b30..d3cb44f5903 100644 --- a/source/blender/freestyle/intern/python/BPy_Operators.cpp +++ b/source/blender/freestyle/intern/python/BPy_Operators.cpp @@ -74,7 +74,7 @@ PyDoc_STRVAR(Operators_select_doc, " condition.\n" "\n" " :arg pred: The predicate expressing this condition.\n" -" :type pred: UnaryPredicate1D"); +" :type pred: :class:`UnaryPredicate1D`"); static PyObject *Operators_select(BPy_Operators *self, PyObject *args, PyObject *kwds) { @@ -372,7 +372,7 @@ PyDoc_STRVAR(Operators_recursive_split_doc, " condition. This predicate is evaluated for each curve before it\n" " actually gets split. If pred_1d(chain) is true, the curve won't be\n" " split anymore.\n" -" :type pred: :class:`UnaryPredicate1D`\n" +" :type pred_1d: :class:`UnaryPredicate1D`\n" " :arg sampling: The resolution used to sample the chain for the\n" " predicates evaluation. (The chain is not actually resampled, a\n" " virtual point only progresses along the curve using this\n" @@ -404,7 +404,7 @@ PyDoc_STRVAR(Operators_recursive_split_doc, " condition. This predicate is evaluated for each curve before it\n" " actually gets split. If pred_1d(chain) is true, the curve won't be\n" " split anymore.\n" -" :type pred: :class:`UnaryPredicate1D`\n" +" :type pred_1d: :class:`UnaryPredicate1D`\n" " :arg sampling: The resolution used to sample the chain for the\n" " predicates evaluation. (The chain is not actually resampled; a\n" " virtual point only progresses along the curve using this\n" @@ -484,7 +484,7 @@ PyDoc_STRVAR(Operators_sort_doc, " comparison predicate given as argument.\n" "\n" " :arg pred: The binary predicate used for the comparison.\n" -" :type pred: BinaryPredicate1D"); +" :type pred: :class:`BinaryPredicate1D`"); static PyObject *Operators_sort(BPy_Operators *self, PyObject *args, PyObject *kwds) { @@ -515,7 +515,7 @@ PyDoc_STRVAR(Operators_create_doc, " transform as a stroke.\n" " :type pred: :class:`UnaryPredicate1D`\n" " :arg shaders: The list of shaders used to shade the strokes.\n" -" :type shaders: List of StrokeShader objects"); +" :type shaders: list of :class:`StrokeShader` objects"); static PyObject *Operators_create(BPy_Operators *self, PyObject *args, PyObject *kwds) { @@ -548,6 +548,30 @@ static PyObject *Operators_create(BPy_Operators *self, PyObject *args, PyObject Py_RETURN_NONE; } +PyDoc_STRVAR(Operators_reset_doc, +".. staticmethod:: reset(delete_strokes=True)\n" +"\n" +" Resets the line stylization process to the initial state. The results of\n" +" stroke creation are accumulated if **delete_strokes** is set to False.\n" +"\n" +" :arg delete_strokes: Delete the strokes that are currently stored.\n" +" :type delete_strokes: bool\n"); + +static PyObject *Operators_reset(BPy_Operators *self, PyObject *args, PyObject *kwds) +{ + static const char *kwlist[] = {"delete_strokes", NULL}; + PyObject *obj1 = 0; + if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &PyBool_Type, &obj1)) { + // true is the default + Operators::reset(obj1 ? bool_from_PyBool(obj1) : true); + } + else { + PyErr_SetString(PyExc_RuntimeError, "Operators.reset() failed"); + return NULL; + } + Py_RETURN_NONE; +} + PyDoc_STRVAR(Operators_get_viewedge_from_index_doc, ".. staticmethod:: get_viewedge_from_index(i)\n" "\n" @@ -671,6 +695,7 @@ static PyMethodDef BPy_Operators_methods[] = { Operators_recursive_split_doc}, {"sort", (PyCFunction) Operators_sort, METH_VARARGS | METH_KEYWORDS | METH_STATIC, Operators_sort_doc}, {"create", (PyCFunction) Operators_create, METH_VARARGS | METH_KEYWORDS | METH_STATIC, Operators_create_doc}, + {"reset", (PyCFunction) Operators_reset, METH_VARARGS | METH_KEYWORDS | METH_STATIC, Operators_reset_doc}, {"get_viewedge_from_index", (PyCFunction) Operators_get_viewedge_from_index, METH_VARARGS | METH_KEYWORDS | METH_STATIC, Operators_get_viewedge_from_index_doc}, {"get_chain_from_index", (PyCFunction) Operators_get_chain_from_index, METH_VARARGS | METH_KEYWORDS | METH_STATIC, diff --git a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp index 22ffdedb3d9..43313ef5213 100644 --- a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp +++ b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp @@ -515,7 +515,7 @@ static int StrokeAttribute_alpha_set(BPy_StrokeAttribute *self, PyObject *value, PyDoc_STRVAR(StrokeAttribute_color_doc, "RGB components of the stroke color.\n" "\n" -":type: mathutils.Color"); +":type: :class:`mathutils.Color`"); static PyObject *StrokeAttribute_color_get(BPy_StrokeAttribute *self, void *UNUSED(closure)) { @@ -539,7 +539,7 @@ PyDoc_STRVAR(StrokeAttribute_thickness_doc, "The right (left) component is the thickness on the right (left) of the vertex\n" "when following the stroke.\n" "\n" -":type: mathutils.Vector"); +":type: :class:`mathutils.Vector`"); static PyObject *StrokeAttribute_thickness_get(BPy_StrokeAttribute *self, void *UNUSED(closure)) { diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.cpp index 67cf28eb7cb..8fa87166c7d 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.cpp +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.cpp @@ -33,16 +33,16 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char FalseBP1D___doc__[] = -"Class hierarchy: :class:`BinaryPredicate1D` > :class:`FalseBP1D`\n" +"Class hierarchy: :class:`freestyle.types.BinaryPredicate1D` > :class:`FalseBP1D`\n" "\n" ".. method:: __call__(inter1, inter2)\n" "\n" " Always returns false.\n" "\n" " :arg inter1: The first Interface1D object.\n" -" :type inter1: :class:`Interface1D`\n" +" :type inter1: :class:`freestyle.types.Interface1D`\n" " :arg inter2: The second Interface1D object.\n" -" :type inter2: :class:`Interface1D`\n" +" :type inter2: :class:`freestyle.types.Interface1D`\n" " :return: False.\n" " :rtype: bool\n"; diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.cpp index 155cc29502b..8a0a4ded58d 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.cpp +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.cpp @@ -33,7 +33,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char Length2DBP1D___doc__[] = -"Class hierarchy: :class:`BinaryPredicate1D` > :class:`Length2DBP1D`\n" +"Class hierarchy: :class:`freestyle.types.BinaryPredicate1D` > :class:`Length2DBP1D`\n" "\n" ".. method:: __call__(inter1, inter2)\n" "\n" @@ -41,9 +41,9 @@ static char Length2DBP1D___doc__[] = " of inter2.\n" "\n" " :arg inter1: The first Interface1D object.\n" -" :type inter1: :class:`Interface1D`\n" +" :type inter1: :class:`freestyle.types.Interface1D`\n" " :arg inter2: The second Interface1D object.\n" -" :type inter2: :class:`Interface1D`\n" +" :type inter2: :class:`freestyle.types.Interface1D`\n" " :return: True or false.\n" " :rtype: bool\n"; diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.cpp index 77147745389..b4a256e6f66 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.cpp +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.cpp @@ -33,16 +33,16 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char SameShapeIdBP1D___doc__[] = -"Class hierarchy: :class:`BinaryPredicate1D` > :class:`SameShapeIdBP1D`\n" +"Class hierarchy: :class:`freestyle.types.BinaryPredicate1D` > :class:`SameShapeIdBP1D`\n" "\n" ".. method:: __call__(inter1, inter2)\n" "\n" " Returns true if inter1 and inter2 belong to the same shape.\n" "\n" " :arg inter1: The first Interface1D object.\n" -" :type inter1: :class:`Interface1D`\n" +" :type inter1: :class:`freestyle.types.Interface1D`\n" " :arg inter2: The second Interface1D object.\n" -" :type inter2: :class:`Interface1D`\n" +" :type inter2: :class:`freestyle.types.Interface1D`\n" " :return: True or false.\n" " :rtype: bool\n"; diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.cpp index f7d702da28d..6306905b4aa 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.cpp +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.cpp @@ -33,16 +33,16 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char TrueBP1D___doc__[] = -"Class hierarchy: :class:`BinaryPredicate1D` > :class:`TrueBP1D`\n" +"Class hierarchy: :class:`freestyle.types.BinaryPredicate1D` > :class:`TrueBP1D`\n" "\n" ".. method:: __call__(inter1, inter2)\n" "\n" " Always returns true.\n" "\n" " :arg inter1: The first Interface1D object.\n" -" :type inter1: :class:`Interface1D`\n" +" :type inter1: :class:`freestyle.types.Interface1D`\n" " :arg inter2: The second Interface1D object.\n" -" :type inter2: :class:`Interface1D`\n" +" :type inter2: :class:`freestyle.types.Interface1D`\n" " :return: True.\n" " :rtype: bool\n"; diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.cpp index f029e434988..2072faa43ef 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.cpp +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.cpp @@ -38,7 +38,7 @@ extern "C" { //ViewMapGradientNormBP1D(int level, IntegrationType iType=MEAN, float sampling=2.0) static char ViewMapGradientNormBP1D___doc__[] = -"Class hierarchy: :class:`BinaryPredicate1D` > :class:`ViewMapGradientNormBP1D`\n" +"Class hierarchy: :class:`freestyle.types.BinaryPredicate1D` > :class:`ViewMapGradientNormBP1D`\n" "\n" ".. method:: __init__(level, integration_type=IntegrationType.MEAN, sampling=2.0)\n" "\n" @@ -49,7 +49,7 @@ static char ViewMapGradientNormBP1D___doc__[] = " :type level: int\n" " :arg integration_type: The integration method used to compute a single value\n" " from a set of values.\n" -" :type integration_type: :class:`IntegrationType`\n" +" :type integration_type: :class:`freestyle.types.IntegrationType`\n" " :arg sampling: The resolution used to sample the chain:\n" " GetViewMapGradientNormF0D is evaluated at each sample point and\n" " the result is obtained by combining the resulting values into a\n" @@ -62,9 +62,9 @@ static char ViewMapGradientNormBP1D___doc__[] = " higher for inter1 than for inter2.\n" "\n" " :arg inter1: The first Interface1D object.\n" -" :type inter1: :class:`Interface1D`\n" +" :type inter1: :class:`freestyle.types.Interface1D`\n" " :arg inter2: The second Interface1D object.\n" -" :type inter2: :class:`Interface1D`\n" +" :type inter2: :class:`freestyle.types.Interface1D`\n" " :return: True or false.\n" " :rtype: bool\n"; diff --git a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp index 65d80283fca..ae4fe0764b6 100644 --- a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp @@ -226,7 +226,7 @@ void StrokeVertex_mathutils_register_callback() PyDoc_STRVAR(StrokeVertex_attribute_doc, "StrokeAttribute for this StrokeVertex.\n" "\n" -":type: StrokeAttribute"); +":type: :class:`StrokeAttribute`"); static PyObject *StrokeVertex_attribute_get(BPy_StrokeVertex *self, void *UNUSED(closure)) { @@ -267,7 +267,7 @@ static int StrokeVertex_curvilinear_abscissa_set(BPy_StrokeVertex *self, PyObjec PyDoc_STRVAR(StrokeVertex_point_doc, "2D point coordinates.\n" "\n" -":type: mathutils.Vector"); +":type: :class:`mathutils.Vector`"); static PyObject *StrokeVertex_point_get(BPy_StrokeVertex *self, void *UNUSED(closure)) { diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp index 99ac72db028..6e253b7bf5d 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp @@ -38,7 +38,10 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- PyDoc_STRVAR(ChainPredicateIterator_doc, -"Class hierarchy: :class:`Iterator` > :class:`ViewEdgeIterator` > :class:`ChainingIterator` > " + +"Class hierarchy: :class:`freestyle.types.Iterator` >\n" +":class:`freestyle.types.ViewEdgeIterator` >\n" +":class:`freestyle.types.ChainingIterator` >\n" ":class:`ChainPredicateIterator`\n" "\n" "A \"generic\" user-controlled ViewEdge iterator. This iterator is in\n" @@ -63,7 +66,7 @@ PyDoc_STRVAR(ChainPredicateIterator_doc, " already been chained must be ignored ot not.\n" " :type restrict_to_unvisited: bool\n" " :arg begin: The ViewEdge from where to start the iteration.\n" -" :type begin: :class:`ViewEdge` or None\n" +" :type begin: :class:`freestyle.types.ViewEdge` or None\n" " :arg orientation: If true, we'll look for the next ViewEdge among\n" " the ViewEdges that surround the ending ViewVertex of begin. If\n" " false, we'll search over the ViewEdges surrounding the ending\n" @@ -77,10 +80,10 @@ PyDoc_STRVAR(ChainPredicateIterator_doc, " predicate, a starting ViewEdge and its orientation.\n" "\n" " :arg upred: The unary predicate that the next ViewEdge must satisfy.\n" -" :type upred: :class:`UnaryPredicate1D`\n" +" :type upred: :class:`freestyle.types.UnaryPredicate1D`\n" " :arg bpred: The binary predicate that the next ViewEdge must\n" " satisfy together with the actual pointed ViewEdge.\n" -" :type bpred: :class:`BinaryPredicate1D`\n" +" :type bpred: :class:`freestyle.types.BinaryPredicate1D`\n" " :arg restrict_to_selection: Indicates whether to force the chaining\n" " to stay within the set of selected ViewEdges or not.\n" " :type restrict_to_selection: bool\n" @@ -88,7 +91,7 @@ PyDoc_STRVAR(ChainPredicateIterator_doc, " already been chained must be ignored ot not.\n" " :type restrict_to_unvisited: bool\n" " :arg begin: The ViewEdge from where to start the iteration.\n" -" :type begin: :class:`ViewEdge` or None\n" +" :type begin: :class:`freestyle.types.ViewEdge` or None\n" " :arg orientation: If true, we'll look for the next ViewEdge among\n" " the ViewEdges that surround the ending ViewVertex of begin. If\n" " false, we'll search over the ViewEdges surrounding the ending\n" diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp index 1a082ac93bb..08cfffec860 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp @@ -39,7 +39,9 @@ extern "C" { // ChainSilhouetteIterator (const ChainSilhouetteIterator &brother) PyDoc_STRVAR(ChainSilhouetteIterator_doc, -"Class hierarchy: :class:`Iterator` > :class:`ViewEdgeIterator` > :class:`ChainingIterator` > " +"Class hierarchy: :class:`freestyle.types.Iterator` >\n" +":class:`freestyle.types.ViewEdgeIterator` >\n" +":class:`freestyle.types.ChainingIterator` >\n" ":class:`ChainSilhouetteIterator`\n" "\n" "A ViewEdge Iterator used to follow ViewEdges the most naturally. For\n" @@ -58,7 +60,7 @@ PyDoc_STRVAR(ChainSilhouetteIterator_doc, " to stay within the set of selected ViewEdges or not.\n" " :type restrict_to_selection: bool\n" " :arg begin: The ViewEdge from where to start the iteration.\n" -" :type begin: :class:`ViewEdge` or None\n" +" :type begin: :class:`freestyle.types.ViewEdge` or None\n" " :arg orientation: If true, we'll look for the next ViewEdge among\n" " the ViewEdges that surround the ending ViewVertex of begin. If\n" " false, we'll search over the ViewEdges surrounding the ending\n" diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp index fca4c979bbb..c972db1e680 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp @@ -138,8 +138,8 @@ static PyObject *Interface0DIterator_iternext(BPy_Interface0DIterator *self) PyDoc_STRVAR(Interface0DIterator_object_doc, "The 0D object currently pointed to by this iterator. Note that the object\n" "may be an instance of an Interface0D subclass. For example if the iterator\n" -"has been created from :method:`Stroke.vertices_begin`, the .object property\n" -"refers to a :class:`StrokeVertex` object.\n" +"has been created from the `vertices_begin()` method of the :class:`Stroke`\n" +"class, the .object property refers to a :class:`StrokeVertex` object.\n" "\n" ":type: :class:`Interface0D` or one of its subclasses."); diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp index 045377e747e..26b83791585 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char BackboneStretcherShader___doc__[] = -"Class hierarchy: :class:`StrokeShader` > :class:`BackboneStretcherShader`\n" +"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`BackboneStretcherShader`\n" "\n" "[Geometry shader]\n" "\n" @@ -52,7 +52,7 @@ static char BackboneStretcherShader___doc__[] = " respective directions: v(1)v(0) and v(n-1)v(n).\n" "\n" " :arg stroke: A Stroke object.\n" -" :type stroke: :class:`Stroke`\n"; +" :type stroke: :class:`freestyle.types.Stroke`\n"; static int BackboneStretcherShader___init__(BPy_BackboneStretcherShader *self, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp index 002d6798df9..df076e0453a 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char BezierCurveShader___doc__[] = -"Class hierarchy: :class:`StrokeShader` > :class:`BezierCurveShader`\n" +"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`BezierCurveShader`\n" "\n" "[Geometry shader]\n" "\n" @@ -54,7 +54,7 @@ static char BezierCurveShader___doc__[] = " Bezier Curve approximation of the original backbone geometry.\n" "\n" " :arg stroke: A Stroke object.\n" -" :type stroke: :class:`Stroke`\n"; +" :type stroke: :class:`freestyle.types.Stroke`\n"; static int BezierCurveShader___init__(BPy_BezierCurveShader *self, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.cpp index 379fb7e1b12..0e603e00f97 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.cpp @@ -37,7 +37,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char BlenderTextureShader___doc__[] = -"Class hierarchy: :class:`StrokeShader` > :class:`BlenderTextureShader`\n" +"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`BlenderTextureShader`\n" "\n" "[Texture shader]\n" "\n" @@ -47,7 +47,8 @@ static char BlenderTextureShader___doc__[] = "\n" " :arg texture: A line style texture slot or a shader node tree to define\n" " a set of textures.\n" -" :type texture: :class:`LineStyleTextureSlot` or :class:`ShaderNodeTree`\n" +" :type texture: :class:`bpy.types.LineStyleTextureSlot` or\n" +" :class:`bpy.types.ShaderNodeTree`\n" "\n" ".. method:: shade(stroke)\n" "\n" @@ -55,7 +56,7 @@ static char BlenderTextureShader___doc__[] = " simulate marks.\n" "\n" " :arg stroke: A Stroke object.\n" -" :type stroke: :class:`Stroke`\n"; +" :type stroke: :class:`freestyle.types.Stroke`\n"; static int BlenderTextureShader___init__(BPy_BlenderTextureShader *self, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp index 6b0c1424d61..fb85ee5a792 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp @@ -36,7 +36,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char CalligraphicShader___doc__[] = -"Class hierarchy: :class:`StrokeShader` > :class:`CalligraphicShader`\n" +"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`CalligraphicShader`\n" "\n" "[Thickness Shader]\n" "\n" @@ -65,7 +65,7 @@ static char CalligraphicShader___doc__[] = " perpendicular to this one, and an interpolation inbetween.\n" "\n" " :arg stroke: A Stroke object.\n" -" :type stroke: :class:`Stroke`\n"; +" :type stroke: :class:`freestyle.types.Stroke`\n"; static int CalligraphicShader___init__(BPy_CalligraphicShader *self, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp index f3b9167de09..c4ed45ec820 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char ColorNoiseShader___doc__[] = -"Class hierarchy: :class:`StrokeShader` > :class:`ColorNoiseShader`\n" +"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`ColorNoiseShader`\n" "\n" "[Color shader]\n" "\n" @@ -53,7 +53,7 @@ static char ColorNoiseShader___doc__[] = " Shader to add noise to the stroke colors.\n" "\n" " :arg stroke: A Stroke object.\n" -" :type stroke: :class:`Stroke`\n"; +" :type stroke: :class:`freestyle.types.Stroke`\n"; static int ColorNoiseShader___init__(BPy_ColorNoiseShader *self, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.cpp index 183edd1f6a0..173e00b0ed8 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.cpp @@ -36,7 +36,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char ColorVariationPatternShader___doc__[] = -"Class hierarchy: :class:`StrokeShader` > :class:`ColorVariationPatternShader`\n" +"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`ColorVariationPatternShader`\n" "\n" "[Color shader]\n" "\n" @@ -57,7 +57,7 @@ static char ColorVariationPatternShader___doc__[] = " result of the multiplication of the pattern and the original color.\n" "\n" " :arg stroke: A Stroke object.\n" -" :type stroke: :class:`Stroke`\n"; +" :type stroke: :class:`freestyle.types.Stroke`\n"; static int ColorVariationPatternShader___init__(BPy_ColorVariationPatternShader *self, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp index b5607f7a7b4..6607d5798f4 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char ConstantColorShader___doc__[] = -"Class hierarchy: :class:`StrokeShader` > :class:`ConstantColorShader`\n" +"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`ConstantColorShader`\n" "\n" "[Color shader]\n" "\n" @@ -57,7 +57,7 @@ static char ConstantColorShader___doc__[] = " Assigns a constant color to every vertex of the Stroke.\n" "\n" " :arg stroke: A Stroke object.\n" -" :type stroke: :class:`Stroke`\n"; +" :type stroke: :class:`freestyle.types.Stroke`\n"; static int ConstantColorShader___init__(BPy_ConstantColorShader *self, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp index 6bc348dd7c5..c8cc41303d8 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char ConstantThicknessShader___doc__[] = -"Class hierarchy: :class:`StrokeShader` > :class:`ConstantThicknessShader`\n" +"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`ConstantThicknessShader`\n" "\n" "[Thickness shader]\n" "\n" @@ -51,7 +51,7 @@ static char ConstantThicknessShader___doc__[] = " Assigns an absolute constant thickness to every vertex of the Stroke.\n" "\n" " :arg stroke: A Stroke object.\n" -" :type stroke: :class:`Stroke`\n"; +" :type stroke: :class:`freestyle.types.Stroke`\n"; static int ConstantThicknessShader___init__(BPy_ConstantThicknessShader *self, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp index 119ba84abd3..6e1886398b6 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char ConstrainedIncreasingThicknessShader___doc__[] = -"Class hierarchy: :class:`StrokeShader` > :class:`ConstrainedIncreasingThicknessShader`\n" +"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`ConstrainedIncreasingThicknessShader`\n" "\n" "[Thickness shader]\n" "\n" @@ -57,7 +57,7 @@ static char ConstrainedIncreasingThicknessShader___doc__[] = " fat short lines.\n" "\n" " :arg stroke: A Stroke object.\n" -" :type stroke: :class:`Stroke`\n"; +" :type stroke: :class:`freestyle.types.Stroke`\n"; static int ConstrainedIncreasingThicknessShader___init__(BPy_ConstrainedIncreasingThicknessShader *self, PyObject *args, PyObject *kwds) diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp index e2a9a99a392..0c9b26fa434 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GuidingLinesShader___doc__[] = -"Class hierarchy: :class:`StrokeShader` > :class:`GuidingLinesShader`\n" +"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`GuidingLinesShader`\n" "\n" "[Geometry shader]\n" "\n" @@ -59,7 +59,7 @@ static char GuidingLinesShader___doc__[] = " approximation is.\n" "\n" " :arg stroke: A Stroke object.\n" -" :type stroke: :class:`Stroke`\n"; +" :type stroke: :class:`freestyle.types.Stroke`\n"; static int GuidingLinesShader___init__(BPy_GuidingLinesShader *self, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp index cec0aeba58c..1ed98d62dd9 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char IncreasingColorShader___doc__[] = -"Class hierarchy: :class:`StrokeShader` > :class:`IncreasingColorShader`\n" +"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`IncreasingColorShader`\n" "\n" "[Color shader]\n" "\n" @@ -67,7 +67,7 @@ static char IncreasingColorShader___doc__[] = " between the first and the last vertex.\n" "\n" " :arg stroke: A Stroke object.\n" -" :type stroke: :class:`Stroke`\n"; +" :type stroke: :class:`freestyle.types.Stroke`\n"; static int IncreasingColorShader___init__(BPy_IncreasingColorShader *self, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp index ef84b9d6fd3..c9c38a9b70a 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char IncreasingThicknessShader___doc__[] = -"Class hierarchy: :class:`StrokeShader` > :class:`IncreasingThicknessShader`\n" +"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`IncreasingThicknessShader`\n" "\n" "[Thickness shader]\n" "\n" @@ -57,7 +57,7 @@ static char IncreasingThicknessShader___doc__[] = " linearly interpolated from A to B.\n" "\n" " :arg stroke: A Stroke object.\n" -" :type stroke: :class:`Stroke`\n"; +" :type stroke: :class:`freestyle.types.Stroke`\n"; static int IncreasingThicknessShader___init__(BPy_IncreasingThicknessShader *self, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp index f405162a918..f5df1ed929f 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char PolygonalizationShader___doc__[] = -"Class hierarchy: :class:`StrokeShader` > :class:`PolygonalizationShader`\n" +"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`PolygonalizationShader`\n" "\n" "[Geometry shader]\n" "\n" @@ -58,7 +58,7 @@ static char PolygonalizationShader___doc__[] = " error is reached.\n" "\n" " :arg stroke: A Stroke object.\n" -" :type stroke: :class:`Stroke`\n"; +" :type stroke: :class:`freestyle.types.Stroke`\n"; static int PolygonalizationShader___init__(BPy_PolygonalizationShader *self, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp index 94e95362ce7..2fa7b00a3b7 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char SamplingShader___doc__[] = -"Class hierarchy: :class:`StrokeShader` > :class:`SamplingShader`\n" +"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`SamplingShader`\n" "\n" "[Geometry shader]\n" "\n" @@ -51,7 +51,7 @@ static char SamplingShader___doc__[] = " Resamples the stroke.\n" "\n" " :arg stroke: A Stroke object.\n" -" :type stroke: :class:`Stroke`\n"; +" :type stroke: :class:`freestyle.types.Stroke`\n"; static int SamplingShader___init__(BPy_SamplingShader *self, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp index ca69561d8e0..750dc6b9eb1 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char SmoothingShader___doc__[] = -"Class hierarchy: :class:`StrokeShader` > :class:`SmoothingShader`\n" +"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`SmoothingShader`\n" "\n" "[Geometry shader]\n" "\n" @@ -71,7 +71,7 @@ static char SmoothingShader___doc__[] = " prevent the diffusion across corners.\n" "\n" " :arg stroke: A Stroke object.\n" -" :type stroke: :class:`Stroke`\n"; +" :type stroke: :class:`freestyle.types.Stroke`\n"; static int SmoothingShader___init__(BPy_SmoothingShader *self, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.cpp index ae96400de8f..b28c3bd0f96 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.cpp @@ -36,7 +36,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char SpatialNoiseShader___doc__[] = -"Class hierarchy: :class:`StrokeShader` > :class:`SpatialNoiseShader`\n" +"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`SpatialNoiseShader`\n" "\n" "[Geometry shader]\n" "\n" @@ -61,7 +61,7 @@ static char SpatialNoiseShader___doc__[] = " more noisy.\n" "\n" " :arg stroke: A Stroke object.\n" -" :type stroke: :class:`Stroke`\n"; +" :type stroke: :class:`freestyle.types.Stroke`\n"; static int SpatialNoiseShader___init__(BPy_SpatialNoiseShader *self, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.cpp index 5522dd46f0a..db2807addc4 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.cpp @@ -37,7 +37,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char StrokeTextureShader___doc__[] = -"Class hierarchy: :class:`StrokeShader` > :class:`StrokeTextureShader`\n" +"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`StrokeTextureShader`\n" "\n" "[Texture shader]\n" "\n" @@ -49,7 +49,7 @@ static char StrokeTextureShader___doc__[] = " :type texture_file: str\n" " :arg medium_type: The medium type and therefore, the blending mode\n" " that must be used for the rendering of this stroke.\n" -" :type medium_type: :class:`MediumType`\n" +" :type medium_type: :class:`freestyle.types.MediumType`\n" " :arg tips: Tells whether the texture includes tips or not. If it\n" " is the case, the texture image must respect the following format.\n" " :type tips: bool\n" @@ -74,7 +74,7 @@ static char StrokeTextureShader___doc__[] = " simulate its marks system.\n" "\n" " :arg stroke: A Stroke object.\n" -" :type stroke: :class:`Stroke`\n"; +" :type stroke: :class:`freestyle.types.Stroke`\n"; static int StrokeTextureShader___init__(BPy_StrokeTextureShader *self, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.cpp index 5a7657f2dad..33962f8e41a 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char StrokeTextureStepShader___doc__[] = -"Class hierarchy: :class:`StrokeShader` > :class:`StrokeTextureStepShader`\n" +"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`StrokeTextureStepShader`\n" "\n" "[Texture shader]\n" "\n" @@ -51,7 +51,7 @@ static char StrokeTextureStepShader___doc__[] = " Assigns a spacing factor to the texture coordinates of the Stroke.\n" "\n" " :arg stroke: A Stroke object.\n" -" :type stroke: :class:`Stroke`\n"; +" :type stroke: :class:`freestyle.types.Stroke`\n"; static int StrokeTextureStepShader___init__(BPy_StrokeTextureStepShader *self, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.cpp index 11bac684cf0..78a07cb6c38 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char TextureAssignerShader___doc__[] = -"Class hierarchy: :class:`StrokeShader` > :class:`TextureAssignerShader`\n" +"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`TextureAssignerShader`\n" "\n" "[Texture shader]\n" "\n" @@ -67,7 +67,7 @@ static char TextureAssignerShader___doc__[] = " * Default: `/brushes/smoothAlpha.bmp`, `Stroke.OPAQUE_MEDIUM`\n" "\n" " :arg stroke: A Stroke object.\n" -" :type stroke: :class:`Stroke`\n"; +" :type stroke: :class:`freestyle.types.Stroke`\n"; static int TextureAssignerShader___init__(BPy_TextureAssignerShader *self, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp index 655a5c8fe98..acd4f4172fb 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char ThicknessNoiseShader___doc__[] = -"Class hierarchy: :class:`StrokeShader` > :class:`ThicknessNoiseShader`\n" +"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`ThicknessNoiseShader`\n" "\n" "[Thickness shader]\n" "\n" @@ -53,7 +53,7 @@ static char ThicknessNoiseShader___doc__[] = " Adds some noise to the stroke thickness.\n" "\n" " :arg stroke: A Stroke object.\n" -" :type stroke: :class:`Stroke`\n"; +" :type stroke: :class:`freestyle.types.Stroke`\n"; static int ThicknessNoiseShader___init__(BPy_ThicknessNoiseShader *self, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.cpp index 1f892455b29..3196065cd34 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.cpp @@ -36,7 +36,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char ThicknessVariationPatternShader___doc__[] = -"Class hierarchy: :class:`StrokeShader` > :class:`ThicknessVariationPatternShader`\n" +"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`ThicknessVariationPatternShader`\n" "\n" "[Thickness shader]\n" "\n" @@ -61,7 +61,7 @@ static char ThicknessVariationPatternShader___doc__[] = " original thickness.\n" "\n" " :arg stroke: A Stroke object.\n" -" :type stroke: :class:`Stroke`\n"; +" :type stroke: :class:`freestyle.types.Stroke`\n"; static int ThicknessVariationPatternShader___init__(BPy_ThicknessVariationPatternShader *self, PyObject *args, PyObject *kwds) diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp index 8b04ee0886f..543cd17c01e 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char TipRemoverShader___doc__[] = -"Class hierarchy: :class:`StrokeShader` > :class:`TipRemoverShader`\n" +"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`TipRemoverShader`\n" "\n" "[Geometry shader]\n" "\n" @@ -52,7 +52,7 @@ static char TipRemoverShader___doc__[] = " Removes the stroke's extremities.\n" "\n" " :arg stroke: A Stroke object.\n" -" :type stroke: :class:`Stroke`\n"; +" :type stroke: :class:`freestyle.types.Stroke`\n"; static int TipRemoverShader___init__(BPy_TipRemoverShader *self, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.cpp index 0c060ef6ed9..b838cae9817 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char fstreamShader___doc__[] = -"Class hierarchy: :class:`StrokeShader` > :class:`fstreamShader`\n" +"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`fstreamShader`\n" "\n" "[Output shader]\n" "\n" @@ -51,7 +51,7 @@ static char fstreamShader___doc__[] = " Streams the Stroke in a file.\n" "\n" " :arg stroke: A Stroke object.\n" -" :type stroke: :class:`Stroke`\n"; +" :type stroke: :class:`freestyle.types.Stroke`\n"; static int fstreamShader___init__(BPy_fstreamShader *self, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.cpp index daa10e1b38f..97a6ca0d39e 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char streamShader___doc__[] = -"Class hierarchy: :class:`StrokeShader` > :class:`streamShader`\n" +"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`streamShader`\n" "\n" "[Output shader]\n" "\n" @@ -48,7 +48,7 @@ static char streamShader___doc__[] = " Streams the Stroke into stdout.\n" "\n" " :arg stroke: A Stroke object.\n" -" :type stroke: :class:`Stroke`\n"; +" :type stroke: :class:`freestyle.types.Stroke`\n"; static int streamShader___init__(BPy_streamShader *self, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.cpp index e2e49116106..841338ef81c 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char ShapeIdF0D___doc__[] = -"Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DId` > :class:`ShapeIdF0D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DId` > :class:`ShapeIdF0D`\n" "\n" ".. method:: __init__()\n" "\n" @@ -43,19 +43,20 @@ static char ShapeIdF0D___doc__[] = "\n" ".. method:: __call__(it)\n" "\n" -" Returns the :class:`Id` of the Shape the :class:`Interface0D`\n" -" pointed by the Interface0DIterator belongs to. This evaluation can\n" -" be ambiguous (in the case of a :class:`TVertex` for example). This\n" +" Returns the :class:`freestyle.types.Id` of the Shape the\n" +" :class:`freestyle.types.Interface0D` pointed by the\n" +" Interface0DIterator belongs to. This evaluation can be ambiguous (in\n" +" the case of a :class:`freestyle.types.TVertex` for example). This\n" " functor tries to remove this ambiguity using the context offered by\n" -" the 1D element to which the Interface0DIterator belongs to.\n" -" However, there still can be problematic cases, and the user willing\n" -" to deal with this cases in a specific way should implement its own\n" +" the 1D element to which the Interface0DIterator belongs to. However,\n" +" there still can be problematic cases, and the user willing to deal\n" +" with this cases in a specific way should implement its own\n" " getShapeIdF0D functor.\n" "\n" " :arg it: An Interface0DIterator object.\n" -" :type it: :class:`Interface0DIterator`\n" +" :type it: :class:`freestyle.types.Interface0DIterator`\n" " :return: The Id of the Shape the pointed Interface0D belongs to.\n" -" :rtype: :class:`Id`\n"; +" :rtype: :class:`freestyle.types.Id`\n"; static int ShapeIdF0D___init__(BPy_ShapeIdF0D *self, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.cpp index b54ed48edc3..cbb905dcf2e 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char MaterialF0D___doc__[] = -"Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DMaterial` > :class:`MaterialF0D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DMaterial` > :class:`MaterialF0D`\n" "\n" ".. method:: __init__()\n" "\n" @@ -44,22 +44,22 @@ static char MaterialF0D___doc__[] = ".. method:: __call__(it)\n" "\n" " Returns the material of the object evaluated at the\n" -" :class:`Interface0D` pointed by the Interface0DIterator. This\n" -" evaluation can be ambiguous (in the case of a :class:`TVertex` for\n" -" example. This functor tries to remove this ambiguity using the\n" -" context offered by the 1D element to which the Interface0DIterator\n" -" belongs to and by arbitrary choosing the material of the face that\n" -" lies on its left when following the 1D element if there are two\n" -" different materials on each side of the point. However, there\n" -" still can be problematic cases, and the user willing to deal with\n" -" this cases in a specific way should implement its own getMaterial\n" -" functor.\n" +" :class:`freestyle.types.Interface0D` pointed by the\n" +" Interface0DIterator. This evaluation can be ambiguous (in the case of\n" +" a :class:`freestyle.types.TVertex` for example. This functor tries to\n" +" remove this ambiguity using the context offered by the 1D element to\n" +" which the Interface0DIterator belongs to and by arbitrary choosing the\n" +" material of the face that lies on its left when following the 1D\n" +" element if there are two different materials on each side of the\n" +" point. However, there still can be problematic cases, and the user\n" +" willing to deal with this cases in a specific way should implement its\n" +" own getMaterial functor.\n" "\n" " :arg it: An Interface0DIterator object.\n" -" :type it: :class:`Interface0DIterator`\n" +" :type it: :class:`freestyle.types.Interface0DIterator`\n" " :return: The material of the object evaluated at the pointed\n" " Interface0D.\n" -" :rtype: :class:`Material`\n"; +" :rtype: :class:`freestyle.types.Material`\n"; static int MaterialF0D___init__(BPy_MaterialF0D *self, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.cpp index 63c32655da3..41ce2f5d197 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char CurveNatureF0D___doc__[] = -"Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DEdgeNature` > :class:`CurveNatureF0D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DEdgeNature` > :class:`CurveNatureF0D`\n" "\n" ".. method:: __init__()\n" "\n" @@ -43,14 +43,14 @@ static char CurveNatureF0D___doc__[] = "\n" ".. method:: __call__(it)\n" "\n" -" Returns the :class:`Nature` of the 1D element the Interface0D pointed\n" -" by the Interface0DIterator belongs to.\n" +" Returns the :class:`freestyle.types.Nature` of the 1D element the\n" +" Interface0D pointed by the Interface0DIterator belongs to.\n" "\n" " :arg it: An Interface0DIterator object.\n" -" :type it: :class:`Interface0DIterator`\n" +" :type it: :class:`freestyle.types.Interface0DIterator`\n" " :return: The nature of the 1D element to which the pointed Interface0D\n" " belongs.\n" -" :rtype: :class:`Nature`\n"; +" :rtype: :class:`freestyle.types.Nature`\n"; static int CurveNatureF0D___init__(BPy_CurveNatureF0D *self, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.cpp index 10152f594c9..bfe060bc046 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char Normal2DF0D___doc__[] = -"Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DVec2f` > :class:`Normal2DF0D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DVec2f` > :class:`Normal2DF0D`\n" "\n" ".. method:: __init__()\n" "\n" @@ -44,12 +44,12 @@ static char Normal2DF0D___doc__[] = ".. method:: __call__(it)\n" "\n" " Returns a two-dimensional vector giving the normalized 2D normal to\n" -" the 1D element to which the :class:`Interface0D` pointed by the\n" -" Interface0DIterator belongs. The normal is evaluated at the pointed\n" -" Interface0D.\n" +" the 1D element to which the :class:`freestyle.types.Interface0D`\n" +" pointed by the Interface0DIterator belongs. The normal is evaluated\n" +" at the pointed Interface0D.\n" "\n" " :arg it: An Interface0DIterator object.\n" -" :type it: :class:`Interface0DIterator`\n" +" :type it: :class:`freestyle.types.Interface0DIterator`\n" " :return: The 2D normal of the 1D element evaluated at the pointed\n" " Interface0D.\n" " :rtype: :class:`mathutils.Vector`\n"; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.cpp index a97b53451c7..70d122bd97a 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char VertexOrientation2DF0D___doc__[] = -"Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DVec2f` > :class:`VertexOrientation2DF0D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DVec2f` > :class:`VertexOrientation2DF0D`\n" "\n" ".. method:: __init__()\n" "\n" @@ -43,13 +43,13 @@ static char VertexOrientation2DF0D___doc__[] = "\n" ".. method:: __call__(it)\n" "\n" -" Returns a two-dimensional vector giving the 2D oriented tangent to\n" -" the 1D element to which the :class:`Interface0D` pointed by the\n" -" Interface0DIterator belongs. The 2D oriented tangent is evaluated\n" -" at the pointed Interface0D.\n" +" Returns a two-dimensional vector giving the 2D oriented tangent to the\n" +" 1D element to which the :class:`freestyle.types.Interface0D` pointed\n" +" by the Interface0DIterator belongs. The 2D oriented tangent is\n" +" evaluated at the pointed Interface0D.\n" "\n" " :arg it: An Interface0DIterator object.\n" -" :type it: :class:`Interface0DIterator`\n" +" :type it: :class:`freestyle.types.Interface0DIterator`\n" " :return: The 2D oriented tangent to the 1D element evaluated at the\n" " pointed Interface0D.\n" " :rtype: :class:`mathutils.Vector`\n"; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.cpp index ffa8996f9b2..6b010af4228 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char VertexOrientation3DF0D___doc__[] = -"Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DVec3f` > :class:`VertexOrientation3DF0D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DVec3f` > :class:`VertexOrientation3DF0D`\n" "\n" ".. method:: __init__()\n" "\n" @@ -43,13 +43,13 @@ static char VertexOrientation3DF0D___doc__[] = "\n" ".. method:: __call__(it)\n" "\n" -" Returns a three-dimensional vector giving the 3D oriented tangent\n" -" to the 1D element to which the :class:`Interface0D` pointed by the\n" -" Interface0DIterator belongs. The 3D oriented tangent is evaluated\n" -" at the pointed Interface0D.\n" +" Returns a three-dimensional vector giving the 3D oriented tangent to\n" +" the 1D element to which the :class:`freestyle.types.Interface0D`\n" +" pointed by the Interface0DIterator belongs. The 3D oriented tangent\n" +" is evaluated at the pointed Interface0D.\n" "\n" " :arg it: An Interface0DIterator object.\n" -" :type it: :class:`Interface0DIterator`\n" +" :type it: :class:`freestyle.types.Interface0DIterator`\n" " :return: The 3D oriented tangent to the 1D element evaluated at the\n" " pointed Interface0D.\n" " :rtype: :class:`mathutils.Vector`\n"; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.cpp index 3523b08982a..ba16fec1539 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetOccludeeF0D___doc__[] = -"Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DViewShape` > :class:`GetOccludeeF0D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DViewShape` > :class:`GetOccludeeF0D`\n" "\n" ".. method:: __init__()\n" "\n" @@ -43,13 +43,13 @@ static char GetOccludeeF0D___doc__[] = "\n" ".. method:: __call__(it)\n" "\n" -" Returns the :class:`ViewShape` that the Interface0D pointed by the\n" -" Interface0DIterator occludes.\n" +" Returns the :class:`freestyle.types.ViewShape` that the Interface0D\n" +" pointed by the Interface0DIterator occludes.\n" "\n" " :arg it: An Interface0DIterator object.\n" -" :type it: :class:`Interface0DIterator`\n" +" :type it: :class:`freestyle.types.Interface0DIterator`\n" " :return: The ViewShape occluded by the pointed Interface0D.\n" -" :rtype: :class:`ViewShape`\n"; +" :rtype: :class:`freestyle.types.ViewShape`\n"; static int GetOccludeeF0D___init__(BPy_GetOccludeeF0D *self, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.cpp index 234dc648ff5..5e4111de924 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.cpp @@ -35,21 +35,21 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetShapeF0D___doc__[] = -"Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DViewShape` > :class:`GetShapeF0D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DViewShape` > :class:`GetShapeF0D`\n" "\n" ".. method:: __init__()\n" "\n" -" Builds a GetShapeF0D.cpp object.\n" +" Builds a GetShapeF0D object.\n" "\n" ".. method:: __call__(it)\n" "\n" -" Returns the :class:`ViewShape` containing the Interface0D pointed\n" -" by the Interface0DIterator.\n" +" Returns the :class:`freestyle.types.ViewShape` containing the\n" +" Interface0D pointed by the Interface0DIterator.\n" "\n" " :arg it: An Interface0DIterator object.\n" -" :type it: :class:`Interface0DIterator`\n" +" :type it: :class:`freestyle.types.Interface0DIterator`\n" " :return: The ViewShape containing the pointed Interface0D.\n" -" :rtype: :class:`ViewShape`\n"; +" :rtype: :class:`freestyle.types.ViewShape`\n"; static int GetShapeF0D___init__(BPy_GetShapeF0D *self, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.cpp index 3d343762b8e..55f7bab3bb3 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char Curvature2DAngleF0D___doc__[] = -"Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DDouble` > :class:`Curvature2DAngleF0D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DDouble` > :class:`Curvature2DAngleF0D`\n" "\n" ".. method:: __init__()\n" "\n" @@ -43,13 +43,13 @@ static char Curvature2DAngleF0D___doc__[] = "\n" ".. method:: __call__(it)\n" "\n" -" Returns a real value giving the 2D curvature (as an angle) of the\n" -" 1D element to which the :class:`Interface0D` pointed by the\n" -" Interface0DIterator belongs. The 2D curvature is evaluated at the\n" +" Returns a real value giving the 2D curvature (as an angle) of the 1D\n" +" element to which the :class:`freestyle.types.Interface0D` pointed by\n" +" the Interface0DIterator belongs. The 2D curvature is evaluated at the\n" " Interface0D.\n" "\n" " :arg it: An Interface0DIterator object.\n" -" :type it: :class:`Interface0DIterator`\n" +" :type it: :class:`freestyle.types.Interface0DIterator`\n" " :return: The 2D curvature of the 1D element evaluated at the\n" " pointed Interface0D.\n" " :rtype: float\n"; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.cpp index 84a3fd79608..2aac3f4f1f0 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char DensityF0D___doc__[] = -"Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DDouble` > :class:`DensityF0D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DDouble` > :class:`DensityF0D`\n" "\n" ".. method:: __init__(sigma=2.0)\n" "\n" @@ -49,12 +49,13 @@ static char DensityF0D___doc__[] = ".. method:: __call__(it)\n" "\n" " Returns the density of the (result) image evaluated at the\n" -" :class:`Interface0D` pointed by the Interface0DIterator. This\n" -" density is evaluated using a pixels square window around the\n" -" evaluation point and integrating these values using a gaussian.\n" +" :class:`freestyle.types.Interface0D` pointed by the\n" +" Interface0DIterator. This density is evaluated using a pixels square\n" +" window around the evaluation point and integrating these values using\n" +" a gaussian.\n" "\n" " :arg it: An Interface0DIterator object.\n" -" :type it: :class:`Interface0DIterator`\n" +" :type it: :class:`freestyle.types.Interface0DIterator`\n" " :return: The density of the image evaluated at the pointed\n" " Interface0D.\n" " :rtype: float\n"; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.cpp index d901b245247..123772b3fc7 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetProjectedXF0D___doc__[] = -"Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DDouble` > :class:`GetProjectedXF0D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DDouble` > :class:`GetProjectedXF0D`\n" "\n" ".. method:: __init__()\n" "\n" @@ -43,11 +43,11 @@ static char GetProjectedXF0D___doc__[] = "\n" ".. method:: __call__(it)\n" "\n" -" Returns the X 3D projected coordinate of the :class:`Interface0D`\n" +" Returns the X 3D projected coordinate of the :class:`freestyle.types.Interface0D`\n" " pointed by the Interface0DIterator.\n" "\n" " :arg it: An Interface0DIterator object.\n" -" :type it: :class:`Interface0DIterator`\n" +" :type it: :class:`freestyle.types.Interface0DIterator`\n" " :return: The X 3D projected coordinate of the pointed Interface0D.\n" " :rtype: float\n"; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.cpp index 2d82182f011..f4e3d6ba76f 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetProjectedYF0D___doc__[] = -"Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DDouble` > :class:`GetProjectedYF0D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DDouble` > :class:`GetProjectedYF0D`\n" "\n" ".. method:: __init__()\n" "\n" @@ -43,11 +43,11 @@ static char GetProjectedYF0D___doc__[] = "\n" ".. method:: __call__(it)\n" "\n" -" Returns the Y 3D projected coordinate of the :class:`Interface0D`\n" +" Returns the Y 3D projected coordinate of the :class:`freestyle.types.Interface0D`\n" " pointed by the Interface0DIterator.\n" "\n" " :arg it: An Interface0DIterator object.\n" -" :type it: :class:`Interface0DIterator`\n" +" :type it: :class:`freestyle.types.Interface0DIterator`\n" " :return: The Y 3D projected coordinate of the pointed Interface0D.\n" " :rtype: float\n"; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.cpp index 9766985954b..116bb75fc55 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetProjectedZF0D___doc__[] = -"Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DDouble` > :class:`GetProjectedZF0D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DDouble` > :class:`GetProjectedZF0D`\n" "\n" ".. method:: __init__()\n" "\n" @@ -43,11 +43,11 @@ static char GetProjectedZF0D___doc__[] = "\n" ".. method:: __call__(it)\n" "\n" -" Returns the Z 3D projected coordinate of the :class:`Interface0D`\n" +" Returns the Z 3D projected coordinate of the :class:`freestyle.types.Interface0D`\n" " pointed by the Interface0DIterator.\n" "\n" " :arg it: An Interface0DIterator object.\n" -" :type it: :class:`Interface0DIterator`\n" +" :type it: :class:`freestyle.types.Interface0DIterator`\n" " :return: The Z 3D projected coordinate of the pointed Interface0D.\n" " :rtype: float\n"; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.cpp index 9ee87c63bdd..614e92cf7c2 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetXF0D___doc__[] = -"Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DDouble` > :class:`GetXF0D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DDouble` > :class:`GetXF0D`\n" "\n" ".. method:: __init__()\n" "\n" @@ -43,11 +43,11 @@ static char GetXF0D___doc__[] = "\n" ".. method:: __call__(it)\n" "\n" -" Returns the X 3D coordinate of the :class:`Interface0D` pointed by\n" +" Returns the X 3D coordinate of the :class:`freestyle.types.Interface0D` pointed by\n" " the Interface0DIterator.\n" "\n" " :arg it: An Interface0DIterator object.\n" -" :type it: :class:`Interface0DIterator`\n" +" :type it: :class:`freestyle.types.Interface0DIterator`\n" " :return: The X 3D coordinate of the pointed Interface0D.\n" " :rtype: float\n"; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.cpp index 90f8f74e989..1a953b9ebca 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetYF0D___doc__[] = -"Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DDouble` > :class:`GetYF0D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DDouble` > :class:`GetYF0D`\n" "\n" ".. method:: __init__()\n" "\n" @@ -43,11 +43,11 @@ static char GetYF0D___doc__[] = "\n" ".. method:: __call__(it)\n" "\n" -" Returns the Y 3D coordinate of the :class:`Interface0D` pointed by\n" +" Returns the Y 3D coordinate of the :class:`freestyle.types.Interface0D` pointed by\n" " the Interface0DIterator.\n" "\n" " :arg it: An Interface0DIterator object.\n" -" :type it: :class:`Interface0DIterator`\n" +" :type it: :class:`freestyle.types.Interface0DIterator`\n" " :return: The Y 3D coordinate of the pointed Interface0D.\n" " :rtype: float\n"; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.cpp index 8876f2200c2..c985e0f5c99 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetZF0D___doc__[] = -"Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DDouble` > :class:`GetZF0D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DDouble` > :class:`GetZF0D`\n" "\n" ".. method:: __init__()\n" "\n" @@ -43,11 +43,11 @@ static char GetZF0D___doc__[] = "\n" ".. method:: __call__(it)\n" "\n" -" Returns the Z 3D coordinate of the :class:`Interface0D` pointed by\n" +" Returns the Z 3D coordinate of the :class:`freestyle.types.Interface0D` pointed by\n" " the Interface0DIterator.\n" "\n" " :arg it: An Interface0DIterator object.\n" -" :type it: :class:`Interface0DIterator`\n" +" :type it: :class:`freestyle.types.Interface0DIterator`\n" " :return: The Z 3D coordinate of the pointed Interface0D.\n" " :rtype: float\n"; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.cpp index af5edb4eac7..3c7f3b412fe 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char LocalAverageDepthF0D___doc__[] = -"Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DDouble` > :class:`LocalAverageDepthF0D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DDouble` > :class:`LocalAverageDepthF0D`\n" "\n" ".. method:: __init__(mask_size=5.0)\n" "\n" @@ -46,12 +46,13 @@ static char LocalAverageDepthF0D___doc__[] = "\n" ".. method:: __call__(it)\n" "\n" -" Returns the average depth around the :class:`Interface0D` pointed\n" -" by the Interface0DIterator. The result is obtained by querying the\n" -" depth buffer on a window around that point.\n" +" Returns the average depth around the\n" +" :class:`freestyle.types.Interface0D` pointed by the\n" +" Interface0DIterator. The result is obtained by querying the depth\n" +" buffer on a window around that point.\n" "\n" " :arg it: An Interface0DIterator object.\n" -" :type it: :class:`Interface0DIterator`\n" +" :type it: :class:`freestyle.types.Interface0DIterator`\n" " :return: The average depth around the pointed Interface0D.\n" " :rtype: float\n"; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.cpp index b64f6c06e93..f0c58352f4a 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char ZDiscontinuityF0D___doc__[] = -"Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DDouble` > :class:`ZDiscontinuityF0D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DDouble` > :class:`ZDiscontinuityF0D`\n" "\n" ".. method:: __init__()\n" "\n" @@ -44,14 +44,14 @@ static char ZDiscontinuityF0D___doc__[] = ".. method:: __call__(it)\n" "\n" " Returns a real value giving the distance between the\n" -" :class:`Interface0D` pointed by the Interface0DIterator and the\n" -" shape that lies behind (occludee). This distance is evaluated in\n" -" the camera space and normalized between 0 and 1. Therefore, if no\n" -" object is occluded by the shape to which the Interface0D belongs to,\n" -" 1 is returned.\n" +" :class:`freestyle.types.Interface0D` pointed by the\n" +" Interface0DIterator and the shape that lies behind (occludee). This\n" +" distance is evaluated in the camera space and normalized between 0 and\n" +" 1. Therefore, if no object is occluded by the shape to which the\n" +" Interface0D belongs to, 1 is returned.\n" "\n" " :arg it: An Interface0DIterator object.\n" -" :type it: :class:`Interface0DIterator`\n" +" :type it: :class:`freestyle.types.Interface0DIterator`\n" " :return: The normalized distance between the pointed Interface0D\n" " and the occludee.\n" " :rtype: float\n"; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.cpp index 96db3ca7375..a2358e6ebae 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetCurvilinearAbscissaF0D___doc__[] = -"Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DFloat` > :class:`GetCurvilinearAbscissaF0D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DFloat` > :class:`GetCurvilinearAbscissaF0D`\n" "\n" ".. method:: __init__()\n" "\n" @@ -43,12 +43,12 @@ static char GetCurvilinearAbscissaF0D___doc__[] = "\n" ".. method:: __call__(it)\n" "\n" -" Returns the curvilinear abscissa of the :class:`Interface0D`\n" -" pointed by the Interface0DIterator in the context of its 1D\n" -" element.\n" +" Returns the curvilinear abscissa of the\n" +" :class:`freestyle.types.Interface0D` pointed by the\n" +" Interface0DIterator in the context of its 1D element.\n" "\n" " :arg it: An Interface0DIterator object.\n" -" :type it: :class:`Interface0DIterator`\n" +" :type it: :class:`freestyle.types.Interface0DIterator`\n" " :return: The curvilinear abscissa of the pointed Interface0D.\n" " :rtype: float\n"; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp index 045a5041b9c..43061747398 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetParameterF0D___doc__[] = -"Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DFloat` > :class:`GetParameterF0D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DFloat` > :class:`GetParameterF0D`\n" "\n" ".. method:: __init__()\n" "\n" @@ -43,11 +43,11 @@ static char GetParameterF0D___doc__[] = "\n" ".. method:: __call__(it)\n" "\n" -" Returns the parameter of the :class:`Interface0D` pointed by the\n" -" Interface0DIterator in the context of its 1D element.\n" +" Returns the parameter of the :class:`freestyle.types.Interface0D`\n" +" pointed by the Interface0DIterator in the context of its 1D element.\n" "\n" " :arg it: An Interface0DIterator object.\n" -" :type it: :class:`Interface0DIterator`\n" +" :type it: :class:`freestyle.types.Interface0DIterator`\n" " :return: The parameter of an Interface0D.\n" " :rtype: float\n"; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.cpp index 43aebe8c4ec..cecec01dcb5 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetViewMapGradientNormF0D___doc__[] = -"Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DFloat` > :class:`GetViewMapGradientNormF0D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DFloat` > :class:`GetViewMapGradientNormF0D`\n" "\n" ".. method:: __init__(level)\n" "\n" @@ -51,7 +51,7 @@ static char GetViewMapGradientNormF0D___doc__[] = " image.\n" "\n" " :arg it: An Interface0DIterator object.\n" -" :type it: :class:`Interface0DIterator`\n" +" :type it: :class:`freestyle.types.Interface0DIterator`\n" " :return: The norm of the gradient of the global viewmap density\n" " image.\n" " :rtype: float\n"; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.cpp index c1f316a45d3..313826f9307 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char ReadCompleteViewMapPixelF0D___doc__[] = -"Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DFloat` > :class:`ReadCompleteViewMapPixelF0D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DFloat` > :class:`ReadCompleteViewMapPixelF0D`\n" "\n" ".. method:: __init__(level)\n" "\n" @@ -50,7 +50,7 @@ static char ReadCompleteViewMapPixelF0D___doc__[] = " Reads a pixel in one of the level of the complete viewmap.\n" "\n" " :arg it: An Interface0DIterator object.\n" -" :type it: :class:`Interface0DIterator`\n" +" :type it: :class:`freestyle.types.Interface0DIterator`\n" " :return: A pixel in one of the level of the complete viewmap.\n" " :rtype: float\n"; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.cpp index a5c8c0c3b04..8bfccf4c80a 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char ReadMapPixelF0D___doc__[] = -"Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DFloat` > :class:`ReadMapPixelF0D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DFloat` > :class:`ReadMapPixelF0D`\n" "\n" ".. method:: __init__(map_name, level)\n" "\n" @@ -52,7 +52,7 @@ static char ReadMapPixelF0D___doc__[] = " Reads a pixel in a map.\n" "\n" " :arg it: An Interface0DIterator object.\n" -" :type it: :class:`Interface0DIterator`\n" +" :type it: :class:`freestyle.types.Interface0DIterator`\n" " :return: A pixel in a map.\n" " :rtype: float\n"; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp index e46d9f316eb..b36ddf84e71 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char ReadSteerableViewMapPixelF0D___doc__[] = -"Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DFloat` > :class:`ReadSteerableViewMapPixelF0D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DFloat` > :class:`ReadSteerableViewMapPixelF0D`\n" "\n" ".. method:: __init__(orientation, level)\n" "\n" @@ -53,7 +53,7 @@ static char ReadSteerableViewMapPixelF0D___doc__[] = " Reads a pixel in one of the level of one of the steerable viewmaps.\n" "\n" " :arg it: An Interface0DIterator object.\n" -" :type it: :class:`Interface0DIterator`\n" +" :type it: :class:`freestyle.types.Interface0DIterator`\n" " :return: A pixel in one of the level of one of the steerable viewmaps.\n" " :rtype: float\n"; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.cpp index bcd17213c55..8ec982815c8 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char QuantitativeInvisibilityF0D___doc__[] = -"Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DUnsigned` > :class:`QuantitativeInvisibilityF0D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DUnsigned` > :class:`QuantitativeInvisibilityF0D`\n" "\n" ".. method:: __init__()\n" "\n" @@ -43,17 +43,17 @@ static char QuantitativeInvisibilityF0D___doc__[] = "\n" ".. method:: __call__(it)\n" "\n" -" Returns the quantitative invisibility of the :class:`Interface0D`\n" -" pointed by the Interface0DIterator. This evaluation can be\n" -" ambiguous (in the case of a :class:`TVertex` for example). This\n" -" functor tries to remove this ambiguity using the context offered by\n" -" the 1D element to which the Interface0D belongs to. However, there\n" -" still can be problematic cases, and the user willing to deal with\n" -" this cases in a specific way should implement its own getQIF0D\n" -" functor.\n" +" Returns the quantitative invisibility of the\n" +" :class:`freestyle.types.Interface0D` pointed by the\n" +" Interface0DIterator. This evaluation can be ambiguous (in the case of\n" +" a :class:`freestyle.types.TVertex` for example). This functor tries\n" +" to remove this ambiguity using the context offered by the 1D element\n" +" to which the Interface0D belongs to. However, there still can be\n" +" problematic cases, and the user willing to deal with this cases in a\n" +" specific way should implement its own getQIF0D functor.\n" "\n" " :arg it: An Interface0DIterator object.\n" -" :type it: :class:`Interface0DIterator`\n" +" :type it: :class:`freestyle.types.Interface0DIterator`\n" " :return: The quantitative invisibility of the pointed Interface0D.\n" " :rtype: int\n"; diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.cpp index e6dce989822..5504bff74ae 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetOccludersF0D___doc__[] = -"Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DVectorViewShape` > :class:`GetOccludersF0D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DVectorViewShape` > :class:`GetOccludersF0D`\n" "\n" ".. method:: __init__()\n" "\n" @@ -43,14 +43,14 @@ static char GetOccludersF0D___doc__[] = "\n" ".. method:: __call__(it)\n" "\n" -" Returns a list of :class:`ViewShape` objects occluding the\n" -" :class:`Interface0D` pointed by the Interface0DIterator.\n" +" Returns a list of :class:`freestyle.types.ViewShape` objects occluding the\n" +" :class:`freestyle.types.Interface0D` pointed by the Interface0DIterator.\n" "\n" " :arg it: An Interface0DIterator object.\n" -" :type it: :class:`Interface0DIterator`\n" +" :type it: :class:`freestyle.types.Interface0DIterator`\n" " :return: A list of ViewShape objects occluding the pointed\n" " Interface0D.\n" -" :rtype: list of :class:`ViewShape` objects\n"; +" :rtype: list of :class:`freestyle.types.ViewShape` objects\n"; static int GetOccludersF0D___init__(BPy_GetOccludersF0D *self, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.cpp index 70c454c2c71..55092416cc2 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.cpp @@ -37,7 +37,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char CurveNatureF1D___doc__[] = -"Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DEdgeNature` > :class:`CurveNatureF1D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DEdgeNature` > :class:`CurveNatureF1D`\n" "\n" ".. method:: __init__(integration_type=IntegrationType.MEAN)\n" "\n" @@ -45,21 +45,22 @@ static char CurveNatureF1D___doc__[] = "\n" " :arg integration_type: The integration method used to compute a single value\n" " from a set of values.\n" -" :type integration_type: :class:`IntegrationType`\n" +" :type integration_type: :class:`freestyle.types.IntegrationType`\n" "\n" ".. method:: __call__(inter)\n" "\n" -" Returns the nature of the Interface1D (silhouette, ridge, crease,\n" -" and so on). Except if the Interface1D is a :class:`ViewEdge`, this\n" -" result might be ambiguous. Indeed, the Interface1D might result\n" -" from the gathering of several 1D elements, each one being of a\n" -" different nature. An integration method, such as the MEAN, might\n" -" give, in this case, irrelevant results.\n" +" Returns the nature of the Interface1D (silhouette, ridge, crease, and\n" +" so on). Except if the Interface1D is a\n" +" :class:`freestyle.types.ViewEdge`, this result might be ambiguous.\n" +" Indeed, the Interface1D might result from the gathering of several 1D\n" +" elements, each one being of a different nature. An integration\n" +" method, such as the MEAN, might give, in this case, irrelevant\n" +" results.\n" "\n" " :arg inter: An Interface1D object.\n" -" :type inter: :class:`Interface1D`\n" +" :type inter: :class:`freestyle.types.Interface1D`\n" " :return: The nature of the Interface1D.\n" -" :rtype: :class:`Nature`\n"; +" :rtype: :class:`freestyle.types.Nature`\n"; static int CurveNatureF1D___init__(BPy_CurveNatureF1D *self, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.cpp index 6be8b81f43f..76330c77927 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.cpp @@ -37,7 +37,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char Normal2DF1D___doc__[] = -"Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DVec2f` > :class:`Normal2DF1D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DVec2f` > :class:`Normal2DF1D`\n" "\n" ".. method:: __init__(integration_type=IntegrationType.MEAN)\n" "\n" @@ -45,14 +45,14 @@ static char Normal2DF1D___doc__[] = "\n" " :arg integration_type: The integration method used to compute a single value\n" " from a set of values.\n" -" :type integration_type: :class:`IntegrationType`\n" +" :type integration_type: :class:`freestyle.types.IntegrationType`\n" "\n" ".. method:: __call__(inter)\n" "\n" " Returns the 2D normal for the Interface1D.\n" "\n" " :arg inter: An Interface1D object.\n" -" :type inter: :class:`Interface1D`\n" +" :type inter: :class:`freestyle.types.Interface1D`\n" " :return: The 2D normal for the Interface1D.\n" " :rtype: :class:`mathutils.Vector`\n"; diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.cpp index 01a6f8bd602..07aa9071c57 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.cpp @@ -37,7 +37,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char Orientation2DF1D___doc__[] = -"Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DVec2f` > :class:`Orientation2DF1D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DVec2f` > :class:`Orientation2DF1D`\n" "\n" ".. method:: __init__(integration_type=IntegrationType.MEAN)\n" "\n" @@ -45,14 +45,14 @@ static char Orientation2DF1D___doc__[] = "\n" " :arg integration_type: The integration method used to compute a single value\n" " from a set of values.\n" -" :type integration_type: :class:`IntegrationType`\n" +" :type integration_type: :class:`freestyle.types.IntegrationType`\n" "\n" ".. method:: __call__(inter)\n" "\n" " Returns the 2D orientation of the Interface1D.\n" "\n" " :arg inter: An Interface1D object.\n" -" :type inter: :class:`Interface1D`\n" +" :type inter: :class:`freestyle.types.Interface1D`\n" " :return: The 2D orientation of the Interface1D.\n" " :rtype: :class:`mathutils.Vector`\n"; diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.cpp index 4d76fb709d8..56dd67b1d2f 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.cpp @@ -37,7 +37,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char Orientation3DF1D___doc__[] = -"Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DVec3f` > :class:`Orientation3DF1D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DVec3f` > :class:`Orientation3DF1D`\n" "\n" ".. method:: __init__(integration_type=IntegrationType.MEAN)\n" "\n" @@ -45,14 +45,14 @@ static char Orientation3DF1D___doc__[] = "\n" " :arg integration_type: The integration method used to compute a single value\n" " from a set of values.\n" -" :type integration_type: :class:`IntegrationType`\n" +" :type integration_type: :class:`freestyle.types.IntegrationType`\n" "\n" ".. method:: __call__(inter)\n" "\n" " Returns the 3D orientation of the Interface1D.\n" "\n" " :arg inter: An Interface1D object.\n" -" :type inter: :class:`Interface1D`\n" +" :type inter: :class:`freestyle.types.Interface1D`\n" " :return: The 3D orientation of the Interface1D.\n" " :rtype: :class:`mathutils.Vector`\n"; diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.cpp index 4278f088863..e5779ce36e1 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.cpp @@ -37,7 +37,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char Curvature2DAngleF1D___doc__[] = -"Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DDouble` > :class:`Curvature2DAngleF1D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DDouble` > :class:`Curvature2DAngleF1D`\n" "\n" ".. method:: __init__(integration_type=IntegrationType.MEAN)\n" "\n" @@ -45,14 +45,14 @@ static char Curvature2DAngleF1D___doc__[] = "\n" " :arg integration_type: The integration method used to compute a single value\n" " from a set of values.\n" -" :type integration_type: :class:`IntegrationType`\n" +" :type integration_type: :class:`freestyle.types.IntegrationType`\n" "\n" ".. method:: __call__(inter)\n" "\n" " Returns the 2D curvature as an angle for an Interface1D.\n" "\n" " :arg inter: An Interface1D object.\n" -" :type inter: :class:`Interface1D`\n" +" :type inter: :class:`freestyle.types.Interface1D`\n" " :return: The 2D curvature as an angle.\n" " :rtype: float\n"; diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.cpp index 5beb724e9af..ffee3ec81f2 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.cpp @@ -37,7 +37,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char DensityF1D___doc__[] = -"Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DDouble` > :class:`DensityF1D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DDouble` > :class:`DensityF1D`\n" "\n" ".. method:: __init__(sigma=2.0, integration_type=IntegrationType.MEAN, sampling=2.0)\n" "\n" @@ -48,7 +48,7 @@ static char DensityF1D___doc__[] = " :type sigma: float\n" " :arg integration_type: The integration method used to compute a single value\n" " from a set of values.\n" -" :type integration_type: :class:`IntegrationType`\n" +" :type integration_type: :class:`freestyle.types.IntegrationType`\n" " :arg sampling: The resolution used to sample the chain: the\n" " corresponding 0D function is evaluated at each sample point and\n" " the result is obtained by combining the resulting values into a\n" @@ -59,12 +59,12 @@ static char DensityF1D___doc__[] = "\n" " Returns the density evaluated for an Interface1D. The density is\n" " evaluated for a set of points along the Interface1D (using the\n" -" :class:`DensityF0D` functor) with a user-defined sampling and then\n" -" integrated into a single value using a user-defined integration\n" -" method.\n" +" :class:`freestyle.functions.DensityF0D` functor) with a user-defined\n" +" sampling and then integrated into a single value using a user-defined\n" +" integration method.\n" "\n" " :arg inter: An Interface1D object.\n" -" :type inter: :class:`Interface1D`\n" +" :type inter: :class:`freestyle.types.Interface1D`\n" " :return: The density evaluated for an Interface1D.\n" " :rtype: float\n"; diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.cpp index 1a0588383fc..9164032488e 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.cpp @@ -37,7 +37,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetCompleteViewMapDensityF1D___doc__[] = -"Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DDouble` > :class:`GetCompleteViewMapDensityF1D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DDouble` > :class:`GetCompleteViewMapDensityF1D`\n" "\n" ".. method:: __init__(level, integration_type=IntegrationType.MEAN, sampling=2.0)\n" "\n" @@ -48,7 +48,7 @@ static char GetCompleteViewMapDensityF1D___doc__[] = " :type level: int\n" " :arg integration_type: The integration method used to compute a single value\n" " from a set of values.\n" -" :type integration_type: :class:`IntegrationType`\n" +" :type integration_type: :class:`freestyle.types.IntegrationType`\n" " :arg sampling: The resolution used to sample the chain: the\n" " corresponding 0D function is evaluated at each sample point and\n" " the result is obtained by combining the resulting values into a\n" @@ -58,13 +58,14 @@ static char GetCompleteViewMapDensityF1D___doc__[] = ".. method:: __call__(inter)\n" "\n" " Returns the density evaluated for an Interface1D in the complete\n" -" viewmap image. The density is evaluated for a set of points along\n" -" the Interface1D (using the :class:`ReadCompleteViewMapPixelF0D`\n" -" functor) and then integrated into a single value using a\n" -" user-defined integration method.\n" +" viewmap image. The density is evaluated for a set of points along the\n" +" Interface1D (using the\n" +" :class:`freestyle.functions.ReadCompleteViewMapPixelF0D` functor) and\n" +" then integrated into a single value using a user-defined integration\n" +" method.\n" "\n" " :arg inter: An Interface1D object.\n" -" :type inter: :class:`Interface1D`\n" +" :type inter: :class:`freestyle.types.Interface1D`\n" " :return: The density evaluated for the Interface1D in the complete\n" " viewmap image.\n" " :rtype: float\n"; diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp index 41841a83374..517b07f5c7f 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp @@ -37,7 +37,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetDirectionalViewMapDensityF1D___doc__[] = -"Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DDouble` " +"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DDouble` " "> :class:`GetDirectionalViewMapDensityF1D`\n" "\n" ".. method:: __init__(orientation, level, integration_type=IntegrationType.MEAN, sampling=2.0)\n" @@ -52,7 +52,7 @@ static char GetDirectionalViewMapDensityF1D___doc__[] = " :type level: int\n" " :arg integration_type: The integration method used to compute a single value\n" " from a set of values.\n" -" :type integration_type: :class:`IntegrationType`\n" +" :type integration_type: :class:`freestyle.types.IntegrationType`\n" " :arg sampling: The resolution used to sample the chain: the\n" " corresponding 0D function is evaluated at each sample point and\n" " the result is obtained by combining the resulting values into a\n" @@ -61,15 +61,16 @@ static char GetDirectionalViewMapDensityF1D___doc__[] = "\n" ".. method:: __call__(inter)\n" "\n" -" Returns the density evaluated for an Interface1D in of the\n" -" steerable viewmaps image. The direction telling which Directional\n" -" map to choose is explicitely specified by the user. The density is\n" -" evaluated for a set of points along the Interface1D (using the\n" -" :class:`ReadSteerableViewMapPixelF0D` functor) and then integrated\n" -" into a single value using a user-defined integration method.\n" +" Returns the density evaluated for an Interface1D in of the steerable\n" +" viewmaps image. The direction telling which Directional map to choose\n" +" is explicitely specified by the user. The density is evaluated for a\n" +" set of points along the Interface1D (using the\n" +" :class:`freestyle.functions.ReadSteerableViewMapPixelF0D` functor) and\n" +" then integrated into a single value using a user-defined integration\n" +" method.\n" "\n" " :arg inter: An Interface1D object.\n" -" :type inter: :class:`Interface1D`\n" +" :type inter: :class:`freestyle.types.Interface1D`\n" " :return: the density evaluated for an Interface1D in of the\n" " steerable viewmaps image.\n" " :rtype: float\n"; diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.cpp index 9baec0fe70a..290b43e5ea6 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.cpp @@ -37,7 +37,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetProjectedXF1D___doc__[] = -"Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DDouble` > :class:`GetProjectedXF1D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DDouble` > :class:`GetProjectedXF1D`\n" "\n" ".. method:: __init__(integration_type=IntegrationType.MEAN)\n" "\n" @@ -45,14 +45,14 @@ static char GetProjectedXF1D___doc__[] = "\n" " :arg integration_type: The integration method used to compute a single value\n" " from a set of values. \n" -" :type integration_type: :class:`IntegrationType`\n" +" :type integration_type: :class:`freestyle.types.IntegrationType`\n" "\n" ".. method:: __call__(inter)\n" "\n" " Returns the projected X 3D coordinate of an Interface1D.\n" "\n" " :arg inter: An Interface1D object.\n" -" :type inter: :class:`Interface1D`\n" +" :type inter: :class:`freestyle.types.Interface1D`\n" " :return: The projected X 3D coordinate of an Interface1D.\n" " :rtype: float\n"; diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.cpp index 004f014cc0d..7d9f7461908 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.cpp @@ -37,7 +37,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetProjectedYF1D___doc__[] = -"Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DDouble` > :class:`GetProjectedYF1D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DDouble` > :class:`GetProjectedYF1D`\n" "\n" ".. method:: __init__(integration_type=IntegrationType.MEAN)\n" "\n" @@ -45,14 +45,14 @@ static char GetProjectedYF1D___doc__[] = "\n" " :arg integration_type: The integration method used to compute a single value\n" " from a set of values. \n" -" :type integration_type: :class:`IntegrationType`\n" +" :type integration_type: :class:`freestyle.types.IntegrationType`\n" "\n" ".. method:: __call__(inter)\n" "\n" " Returns the projected Y 3D coordinate of an Interface1D.\n" "\n" " :arg inter: An Interface1D object.\n" -" :type inter: :class:`Interface1D`\n" +" :type inter: :class:`freestyle.types.Interface1D`\n" " :return: The projected Y 3D coordinate of an Interface1D.\n" " :rtype: float\n"; diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.cpp index daafe1a3b6f..b8e8cf5e57e 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.cpp @@ -37,7 +37,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetProjectedZF1D___doc__[] = -"Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DDouble` > :class:`GetProjectedZF1D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DDouble` > :class:`GetProjectedZF1D`\n" "\n" ".. method:: __init__(integration_type=IntegrationType.MEAN)\n" "\n" @@ -45,14 +45,14 @@ static char GetProjectedZF1D___doc__[] = "\n" " :arg integration_type: The integration method used to compute a single value\n" " from a set of values. \n" -" :type integration_type: :class:`IntegrationType`\n" +" :type integration_type: :class:`freestyle.types.IntegrationType`\n" "\n" ".. method:: __call__(inter)\n" "\n" " Returns the projected Z 3D coordinate of an Interface1D.\n" "\n" " :arg inter: An Interface1D object.\n" -" :type inter: :class:`Interface1D`\n" +" :type inter: :class:`freestyle.types.Interface1D`\n" " :return: The projected Z 3D coordinate of an Interface1D.\n" " :rtype: float\n"; diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.cpp index 199e437639f..c67485e7d36 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.cpp @@ -37,7 +37,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetSteerableViewMapDensityF1D___doc__[] = -"Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DDouble` > :class:`GetSteerableViewMapDensityF1D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DDouble` > :class:`GetSteerableViewMapDensityF1D`\n" "\n" ".. method:: __init__(level, integration_type=IntegrationType.MEAN, sampling=2.0)\n" "\n" @@ -48,7 +48,7 @@ static char GetSteerableViewMapDensityF1D___doc__[] = " :type level: int\n" " :arg integration_type: The integration method used to compute a single value\n" " from a set of values.\n" -" :type integration_type: :class:`IntegrationType`\n" +" :type integration_type: :class:`freestyle.types.IntegrationType`\n" " :arg sampling: The resolution used to sample the chain: the\n" " corresponding 0D function is evaluated at each sample point and\n" " the result is obtained by combining the resulting values into a\n" @@ -58,11 +58,12 @@ static char GetSteerableViewMapDensityF1D___doc__[] = ".. method:: __call__(inter)\n" "\n" " Returns the density of the ViewMap for a given Interface1D. The\n" -" density of each :class:`FEdge` is evaluated in the proper steerable\n" -" :class:`ViewMap` depending on its orientation.\n" +" density of each :class:`freestyle.types.FEdge` is evaluated in the\n" +" proper steerable :class:`freestyle.types.ViewMap` depending on its\n" +" orientation.\n" "\n" " :arg inter: An Interface1D object.\n" -" :type inter: :class:`Interface1D`\n" +" :type inter: :class:`freestyle.types.Interface1D`\n" " :return: The density of the ViewMap for a given Interface1D.\n" " :rtype: float\n"; diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.cpp index 5c9bd76a4b3..ebcb273082e 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.cpp @@ -37,7 +37,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetViewMapGradientNormF1D___doc__[] = -"Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DDouble` > :class:`GetViewMapGradientNormF1D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DDouble` > :class:`GetViewMapGradientNormF1D`\n" "\n" ".. method:: __init__(level, integration_type=IntegrationType.MEAN, sampling=2.0)\n" "\n" @@ -48,7 +48,7 @@ static char GetViewMapGradientNormF1D___doc__[] = " :type level: int\n" " :arg integration_type: The integration method used to compute a single value\n" " from a set of values.\n" -" :type integration_type: :class:`IntegrationType`\n" +" :type integration_type: :class:`freestyle.types.IntegrationType`\n" " :arg sampling: The resolution used to sample the chain: the\n" " corresponding 0D function is evaluated at each sample point and\n" " the result is obtained by combining the resulting values into a\n" @@ -58,11 +58,12 @@ static char GetViewMapGradientNormF1D___doc__[] = ".. method:: __call__(inter)\n" "\n" " Returns the density of the ViewMap for a given Interface1D. The\n" -" density of each :class:`FEdge` is evaluated in the proper steerable\n" -" :class:`ViewMap` depending on its orientation.\n" +" density of each :class:`freestyle.types.FEdge` is evaluated in the\n" +" proper steerable :class:`freestyle.types.ViewMap` depending on its\n" +" orientation.\n" "\n" " :arg inter: An Interface1D object.\n" -" :type inter: :class:`Interface1D`\n" +" :type inter: :class:`freestyle.types.Interface1D`\n" " :return: The density of the ViewMap for a given Interface1D.\n" " :rtype: float\n"; diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.cpp index fa749a05c69..b55a4a79fe9 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.cpp @@ -37,7 +37,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetXF1D___doc__[] = -"Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DDouble` > :class:`GetXF1D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DDouble` > :class:`GetXF1D`\n" "\n" ".. method:: __init__(integration_type=IntegrationType.MEAN)\n" "\n" @@ -45,14 +45,14 @@ static char GetXF1D___doc__[] = "\n" " :arg integration_type: The integration method used to compute a single value\n" " from a set of values.\n" -" :type integration_type: :class:`IntegrationType`\n" +" :type integration_type: :class:`freestyle.types.IntegrationType`\n" "\n" ".. method:: __call__(inter)\n" "\n" " Returns the X 3D coordinate of an Interface1D.\n" "\n" " :arg inter: An Interface1D object.\n" -" :type inter: :class:`Interface1D`\n" +" :type inter: :class:`freestyle.types.Interface1D`\n" " :return: The X 3D coordinate of the Interface1D.\n" " :rtype: float\n"; diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.cpp index 96022997763..d760ef948f0 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.cpp @@ -37,7 +37,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetYF1D___doc__[] = -"Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DDouble` > :class:`GetYF1D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DDouble` > :class:`GetYF1D`\n" "\n" ".. method:: __init__(integration_type=IntegrationType.MEAN)\n" "\n" @@ -45,14 +45,14 @@ static char GetYF1D___doc__[] = "\n" " :arg integration_type: The integration method used to compute a single value\n" " from a set of values.\n" -" :type integration_type: :class:`IntegrationType`\n" +" :type integration_type: :class:`freestyle.types.IntegrationType`\n" "\n" ".. method:: __call__(inter)\n" "\n" " Returns the Y 3D coordinate of an Interface1D.\n" "\n" " :arg inter: An Interface1D object.\n" -" :type inter: :class:`Interface1D`\n" +" :type inter: :class:`freestyle.types.Interface1D`\n" " :return: The Y 3D coordinate of the Interface1D.\n" " :rtype: float\n"; diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.cpp index 46695affe49..72a8b22630d 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.cpp @@ -37,7 +37,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetZF1D___doc__[] = -"Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DDouble` > :class:`GetZF1D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DDouble` > :class:`GetZF1D`\n" "\n" ".. method:: __init__(integration_type=IntegrationType.MEAN)\n" "\n" @@ -45,14 +45,14 @@ static char GetZF1D___doc__[] = "\n" " :arg integration_type: The integration method used to compute a single value\n" " from a set of values.\n" -" :type integration_type: :class:`IntegrationType`\n" +" :type integration_type: :class:`freestyle.types.IntegrationType`\n" "\n" ".. method:: __call__(inter)\n" "\n" " Returns the Z 3D coordinate of an Interface1D.\n" "\n" " :arg inter: An Interface1D object.\n" -" :type inter: :class:`Interface1D`\n" +" :type inter: :class:`freestyle.types.Interface1D`\n" " :return: The Z 3D coordinate of the Interface1D.\n" " :rtype: float\n"; diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.cpp index 3638908c5bd..424f08c07c0 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.cpp @@ -37,7 +37,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char LocalAverageDepthF1D___doc__[] = -"Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DDouble` > :class:`LocalAverageDepthF1D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DDouble` > :class:`LocalAverageDepthF1D`\n" "\n" ".. method:: __init__(sigma, integration_type=IntegrationType.MEAN)\n" "\n" @@ -48,18 +48,18 @@ static char LocalAverageDepthF1D___doc__[] = " :type sigma: float\n" " :arg integration_type: The integration method used to compute a single value\n" " from a set of values.\n" -" :type integration_type: :class:`IntegrationType`\n" +" :type integration_type: :class:`freestyle.types.IntegrationType`\n" "\n" ".. method:: __call__(inter)\n" "\n" -" Returns the average depth evaluated for an Interface1D. The\n" -" average depth is evaluated for a set of points along the\n" -" Interface1D (using the :class:`LocalAverageDepthF0D` functor) with\n" -" a user-defined sampling and then integrated into a single value\n" -" using a user-defined integration method.\n" +" Returns the average depth evaluated for an Interface1D. The average\n" +" depth is evaluated for a set of points along the Interface1D (using\n" +" the :class:`freestyle.functions.LocalAverageDepthF0D` functor) with a\n" +" user-defined sampling and then integrated into a single value using a\n" +" user-defined integration method.\n" "\n" " :arg inter: An Interface1D object.\n" -" :type inter: :class:`Interface1D`\n" +" :type inter: :class:`freestyle.types.Interface1D`\n" " :return: The average depth evaluated for the Interface1D.\n" " :rtype: float\n"; diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.cpp index 65fde596e23..488675142b6 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.cpp @@ -37,7 +37,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char ZDiscontinuityF1D___doc__[] = -"Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DDouble` > :class:`ZDiscontinuityF1D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DDouble` > :class:`ZDiscontinuityF1D`\n" "\n" ".. method:: __init__(integration_type=IntegrationType.MEAN)\n" "\n" @@ -45,7 +45,7 @@ static char ZDiscontinuityF1D___doc__[] = "\n" " :arg integration_type: The integration method used to compute a single value\n" " from a set of values.\n" -" :type integration_type: :class:`IntegrationType`\n" +" :type integration_type: :class:`freestyle.types.IntegrationType`\n" "\n" ".. method:: __call__(inter)\n" "\n" @@ -56,7 +56,7 @@ static char ZDiscontinuityF1D___doc__[] = " Interface1D belongs to, 1 is returned.\n" "\n" " :arg inter: An Interface1D object.\n" -" :type inter: :class:`Interface1D`\n" +" :type inter: :class:`freestyle.types.Interface1D`\n" " :return: The normalized distance between the Interface1D and the occludee.\n" " :rtype: float\n"; diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.cpp index c70493e9140..a21efd655ab 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.cpp @@ -37,7 +37,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char QuantitativeInvisibilityF1D___doc__[] = -"Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DUnsigned` > :class:`QuantitativeInvisibilityF1D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DUnsigned` > :class:`QuantitativeInvisibilityF1D`\n" "\n" ".. method:: __init__(integration_type=IntegrationType.MEAN)\n" "\n" @@ -45,18 +45,18 @@ static char QuantitativeInvisibilityF1D___doc__[] = "\n" " :arg integration_type: The integration method used to compute a single value\n" " from a set of values.\n" -" :type integration_type: :class:`IntegrationType`\n" +" :type integration_type: :class:`freestyle.types.IntegrationType`\n" "\n" ".. method:: __call__(inter)\n" "\n" -" Returns the Quantitative Invisibility of an Interface1D element.\n" -" If the Interface1D is a :class:`ViewEdge`, then there is no\n" -" ambiguity concerning the result. But, if the Interface1D results\n" +" Returns the Quantitative Invisibility of an Interface1D element. If\n" +" the Interface1D is a :class:`freestyle.types.ViewEdge`, then there is\n" +" no ambiguity concerning the result. But, if the Interface1D results\n" " of a chaining (chain, stroke), then it might be made of several 1D\n" " elements of different Quantitative Invisibilities.\n" "\n" " :arg inter: An Interface1D object.\n" -" :type inter: :class:`Interface1D`\n" +" :type inter: :class:`freestyle.types.Interface1D`\n" " :return: The Quantitative Invisibility of the Interface1D.\n" " :rtype: int\n"; diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.cpp index d0c16f8dae2..e4e7560822d 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.cpp @@ -37,7 +37,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetOccludeeF1D___doc__[] = -"Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DVectorViewShape` > :class:`GetOccludeeF1D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DVectorViewShape` > :class:`GetOccludeeF1D`\n" "\n" ".. method:: __init__()\n" "\n" @@ -48,9 +48,9 @@ static char GetOccludeeF1D___doc__[] = " Returns a list of occluded shapes covered by this Interface1D.\n" "\n" " :arg inter: An Interface1D object.\n" -" :type inter: :class:`Interface1D`\n" +" :type inter: :class:`freestyle.types.Interface1D`\n" " :return: A list of occluded shapes covered by the Interface1D.\n" -" :rtype: list of :class:`ViewShape` objects\n"; +" :rtype: list of :class:`freestyle.types.ViewShape` objects\n"; static int GetOccludeeF1D___init__(BPy_GetOccludeeF1D *self, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.cpp index 62612c7cc19..ced04a5077a 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.cpp @@ -37,7 +37,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetOccludersF1D___doc__[] = -"Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DVectorViewShape` > :class:`GetOccludersF1D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DVectorViewShape` > :class:`GetOccludersF1D`\n" "\n" ".. method:: __init__()\n" "\n" @@ -48,9 +48,9 @@ static char GetOccludersF1D___doc__[] = " Returns a list of occluding shapes that cover this Interface1D.\n" "\n" " :arg inter: An Interface1D object.\n" -" :type inter: :class:`Interface1D`\n" +" :type inter: :class:`freestyle.types.Interface1D`\n" " :return: A list of occluding shapes that cover the Interface1D.\n" -" :rtype: list of :class:`ViewShape` objects\n"; +" :rtype: list of :class:`freestyle.types.ViewShape` objects\n"; static int GetOccludersF1D___init__(BPy_GetOccludersF1D *self, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.cpp index 1dab3962ec2..f26f8105a9e 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.cpp @@ -37,7 +37,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetShapeF1D___doc__[] = -"Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DVectorViewShape` > :class:`GetShapeF1D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DVectorViewShape` > :class:`GetShapeF1D`\n" "\n" ".. method:: __init__()\n" "\n" @@ -48,9 +48,9 @@ static char GetShapeF1D___doc__[] = " Returns a list of shapes covered by this Interface1D.\n" "\n" " :arg inter: An Interface1D object.\n" -" :type inter: :class:`Interface1D`\n" +" :type inter: :class:`freestyle.types.Interface1D`\n" " :return: A list of shapes covered by the Interface1D.\n" -" :rtype: list of :class:`ViewShape` objects\n"; +" :rtype: list of :class:`freestyle.types.ViewShape` objects\n"; static int GetShapeF1D___init__(BPy_GetShapeF1D *self, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.cpp index e585829ff0a..128deeccd11 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.cpp @@ -37,7 +37,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char ChainingTimeStampF1D___doc__[] = -"Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DVoid` > :class:`ChainingTimeStampF1D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DVoid` > :class:`ChainingTimeStampF1D`\n" "\n" ".. method:: __init__()\n" "\n" @@ -48,7 +48,7 @@ static char ChainingTimeStampF1D___doc__[] = " Sets the chaining time stamp of the Interface1D.\n" "\n" " :arg inter: An Interface1D object.\n" -" :type inter: :class:`Interface1D`\n"; +" :type inter: :class:`freestyle.types.Interface1D`\n"; static int ChainingTimeStampF1D___init__(BPy_ChainingTimeStampF1D *self, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.cpp index 96d594ff56e..64a92a8e357 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.cpp @@ -37,7 +37,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char IncrementChainingTimeStampF1D___doc__[] = -"Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DVoid` > :class:`IncrementChainingTimeStampF1D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DVoid` > :class:`IncrementChainingTimeStampF1D`\n" "\n" ".. method:: __init__()\n" "\n" @@ -48,7 +48,7 @@ static char IncrementChainingTimeStampF1D___doc__[] = " Increments the chaining time stamp of the Interface1D.\n" "\n" " :arg inter: An Interface1D object.\n" -" :type inter: :class:`Interface1D`\n"; +" :type inter: :class:`freestyle.types.Interface1D`\n"; static int IncrementChainingTimeStampF1D___init__(BPy_IncrementChainingTimeStampF1D *self, PyObject *args, PyObject *kwds) diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.cpp index 715bbaafdba..2cd359eea61 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.cpp @@ -37,7 +37,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char TimeStampF1D___doc__[] = -"Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DVoid` > :class:`TimeStampF1D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DVoid` > :class:`TimeStampF1D`\n" "\n" ".. method:: __init__()\n" "\n" @@ -48,7 +48,7 @@ static char TimeStampF1D___doc__[] = " Returns the time stamp of the Interface1D.\n" "\n" " :arg inter: An Interface1D object.\n" -" :type inter: :class:`Interface1D`\n"; +" :type inter: :class:`freestyle.types.Interface1D`\n"; static int TimeStampF1D___init__(BPy_TimeStampF1D *self, PyObject *args, PyObject *kwds) { diff --git a/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.cpp index 896348d143c..36511e01358 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.cpp @@ -33,14 +33,14 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char FalseUP0D___doc__[] = -"Class hierarchy: :class:`UnaryPredicate0D` > :class:`FalseUP0D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryPredicate0D` > :class:`FalseUP0D`\n" "\n" ".. method:: __call__(it)\n" "\n" " Always returns false.\n" "\n" " :arg it: An Interface0DIterator object.\n" -" :type it: :class:`Interface0DIterator`\n" +" :type it: :class:`freestyle.types.Interface0DIterator`\n" " :return: False.\n" " :rtype: bool\n"; diff --git a/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.cpp index c4c157dd689..f5da320a31c 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.cpp @@ -33,14 +33,14 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char TrueUP0D___doc__[] = -"Class hierarchy: :class:`UnaryPredicate0D` > :class:`TrueUP0D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryPredicate0D` > :class:`TrueUP0D`\n" "\n" ".. method:: __call__(it)\n" "\n" " Always returns true.\n" "\n" " :arg it: An Interface0DIterator object.\n" -" :type it: :class:`Interface0DIterator`\n" +" :type it: :class:`freestyle.types.Interface0DIterator`\n" " :return: True.\n" " :rtype: bool\n"; diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.cpp index 8365f9b832a..d0ced2ad4c3 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.cpp @@ -33,7 +33,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char ContourUP1D___doc__[] = -"Class hierarchy: :class:`UnaryPredicate1D` > :class:`ContourUP1D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryPredicate1D` > :class:`ContourUP1D`\n" "\n" ".. method:: __call__(inter)\n" "\n" @@ -41,7 +41,7 @@ static char ContourUP1D___doc__[] = " contour if it is borded by a different shape on each of its sides.\n" "\n" " :arg inter: An Interface1D object.\n" -" :type inter: :class:`Interface1D`\n" +" :type inter: :class:`freestyle.types.Interface1D`\n" " :return: True if the Interface1D is a contour, false otherwise.\n" " :rtype: bool\n"; diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.cpp index b0bd67744c5..807d76f4731 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char DensityLowerThanUP1D___doc__[] = -"Class hierarchy: :class:`UnaryPredicate1D` > :class:`DensityLowerThanUP1D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryPredicate1D` > :class:`DensityLowerThanUP1D`\n" "\n" ".. method:: __init__(threshold, sigma=2.0)\n" "\n" @@ -45,7 +45,7 @@ static char DensityLowerThanUP1D___doc__[] = " having a density lower than this threshold will match.\n" " :type threshold: float\n" " :arg sigma: The sigma value defining the density evaluation window\n" -" size used in the :class:`DensityF0D` functor.\n" +" size used in the :class:`freestyle.functions.DensityF0D` functor.\n" " :type sigma: float\n" "\n" ".. method:: __call__(inter)\n" @@ -54,7 +54,7 @@ static char DensityLowerThanUP1D___doc__[] = " than a user-defined density value.\n" "\n" " :arg inter: An Interface1D object.\n" -" :type inter: :class:`Interface1D`\n" +" :type inter: :class:`freestyle.types.Interface1D`\n" " :return: True if the density is lower than a threshold.\n" " :rtype: bool\n"; diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp index 5cc5e0cf12a..f8a7ff8650c 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp @@ -33,7 +33,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char EqualToChainingTimeStampUP1D___doc__[] = -"Class hierarchy: :class:`UnaryPredicate1D` > :class:`EqualToChainingTimeStampUP1D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryPredicate1D` > :class:`freestyle.types.EqualToChainingTimeStampUP1D`\n" "\n" ".. method:: __init__(ts)\n" "\n" @@ -48,7 +48,7 @@ static char EqualToChainingTimeStampUP1D___doc__[] = " user-defined value.\n" "\n" " :arg inter: An Interface1D object.\n" -" :type inter: :class:`Interface1D`\n" +" :type inter: :class:`freestyle.types.Interface1D`\n" " :return: True if the time stamp is equal to a user-defined value.\n" " :rtype: bool\n"; diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp index a2cafcf5fd2..ffed4f966e6 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp @@ -33,7 +33,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char EqualToTimeStampUP1D___doc__[] = -"Class hierarchy: :class:`UnaryPredicate1D` > :class:`EqualToTimeStampUP1D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryPredicate1D` > :class:`EqualToTimeStampUP1D`\n" "\n" ".. method:: __init__(ts)\n" "\n" @@ -48,7 +48,7 @@ static char EqualToTimeStampUP1D___doc__[] = " user-defined value.\n" "\n" " :arg inter: An Interface1D object.\n" -" :type inter: :class:`Interface1D`\n" +" :type inter: :class:`freestyle.types.Interface1D`\n" " :return: True if the time stamp is equal to a user-defined value.\n" " :rtype: bool\n"; diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.cpp index 486b020ef6a..140ebb86454 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.cpp @@ -33,7 +33,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char ExternalContourUP1D___doc__[] = -"Class hierarchy: :class:`UnaryPredicate1D` > :class:`ExternalContourUP1D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryPredicate1D` > :class:`ExternalContourUP1D`\n" "\n" ".. method:: __call__(inter)\n" "\n" @@ -42,7 +42,7 @@ static char ExternalContourUP1D___doc__[] = " one of its sides.\n" "\n" " :arg inter: An Interface1D object.\n" -" :type inter: :class:`Interface1D`\n" +" :type inter: :class:`freestyle.types.Interface1D`\n" " :return: True if the Interface1D is an external contour, false\n" " otherwise.\n" " :rtype: bool\n"; diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.cpp index 098f449048e..2d1e99aed2b 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.cpp @@ -33,14 +33,14 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char FalseUP1D___doc__[] = -"Class hierarchy: :class:`UnaryPredicate1D` > :class:`FalseUP1D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryPredicate1D` > :class:`FalseUP1D`\n" "\n" ".. method:: __call__(inter)\n" "\n" " Always returns false.\n" "\n" " :arg inter: An Interface1D object.\n" -" :type inter: :class:`Interface1D`\n" +" :type inter: :class:`freestyle.types.Interface1D`\n" " :return: False.\n" " :rtype: bool\n"; diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.cpp index 143aac7d4c5..806ad8168ac 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.cpp @@ -33,7 +33,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char QuantitativeInvisibilityUP1D___doc__[] = -"Class hierarchy: :class:`UnaryPredicate1D` > :class:`QuantitativeInvisibilityUP1D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryPredicate1D` > :class:`QuantitativeInvisibilityUP1D`\n" "\n" ".. method:: __init__(qi=0)\n" "\n" @@ -46,11 +46,12 @@ static char QuantitativeInvisibilityUP1D___doc__[] = ".. method:: __call__(inter)\n" "\n" " Returns true if the Quantitative Invisibility evaluated at an\n" -" Interface1D, using the :class:`QuantitativeInvisibilityF1D`\n" -" functor, equals a certain user-defined value.\n" +" Interface1D, using the\n" +" :class:`freestyle.functions.QuantitativeInvisibilityF1D` functor,\n" +" equals a certain user-defined value.\n" "\n" " :arg inter: An Interface1D object.\n" -" :type inter: :class:`Interface1D`\n" +" :type inter: :class:`freestyle.types.Interface1D`\n" " :return: True if Quantitative Invisibility equals a user-defined\n" " value.\n" " :rtype: bool\n"; diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp index 998d6b1ed61..93970972aac 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp @@ -33,7 +33,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char ShapeUP1D___doc__[] = -"Class hierarchy: :class:`UnaryPredicate1D` > :class:`ShapeUP1D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryPredicate1D` > :class:`ShapeUP1D`\n" "\n" ".. method:: __init__(first, second=0)\n" "\n" @@ -46,11 +46,11 @@ static char ShapeUP1D___doc__[] = "\n" ".. method:: __call__(inter)\n" "\n" -" Returns true if the shape to which the Interface1D belongs to has\n" -" the same :class:`Id` as the one specified by the user.\n" +" Returns true if the shape to which the Interface1D belongs to has the\n" +" same :class:`freestyle.types.Id` as the one specified by the user.\n" "\n" " :arg inter: An Interface1D object.\n" -" :type inter: :class:`Interface1D`\n" +" :type inter: :class:`freestyle.types.Interface1D`\n" " :return: True if Interface1D belongs to the shape of the\n" " user-specified Id.\n" " :rtype: bool\n"; diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.cpp index 8444fbfc365..d4ca82721d5 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.cpp @@ -33,14 +33,14 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char TrueUP1D___doc__[] = -"Class hierarchy: :class:`UnaryPredicate1D` > :class:`TrueUP1D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryPredicate1D` > :class:`TrueUP1D`\n" "\n" ".. method:: __call__(inter)\n" "\n" " Always returns true.\n" "\n" " :arg inter: An Interface1D object.\n" -" :type inter: :class:`Interface1D`\n" +" :type inter: :class:`freestyle.types.Interface1D`\n" " :return: True.\n" " :rtype: bool\n"; diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.cpp index 7e310fe593d..6f08cd1c796 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.cpp @@ -33,7 +33,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char WithinImageBoundaryUP1D___doc__[] = -"Class hierarchy: :class:`UnaryPredicate1D` > :class:`WithinImageBoundaryUP1D`\n" +"Class hierarchy: :class:`freestyle.types.UnaryPredicate1D` > :class:`WithinImageBoundaryUP1D`\n" "\n" ".. method:: __init__(xmin, ymin, xmax, ymax)\n" "\n" diff --git a/source/blender/freestyle/intern/scene_graph/SceneHash.cpp b/source/blender/freestyle/intern/scene_graph/SceneHash.cpp new file mode 100644 index 00000000000..6e8856f1b93 --- /dev/null +++ b/source/blender/freestyle/intern/scene_graph/SceneHash.cpp @@ -0,0 +1,39 @@ +/* + * ***** 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. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/freestyle/intern/scene_graph/SceneHash.cpp + * \ingroup freestyle + */ + +#include "SceneHash.h" + +namespace Freestyle { + +void SceneHash::visitIndexedFaceSet(IndexedFaceSet& ifs) +{ + const real *v = ifs.vertices(); + const unsigned n = ifs.vsize(); + + for (unsigned i = 0; i < n; i++) { + _hashcode += v[i]; + } +} + +} /* namespace Freestyle */ diff --git a/source/blender/freestyle/intern/scene_graph/SceneHash.h b/source/blender/freestyle/intern/scene_graph/SceneHash.h new file mode 100644 index 00000000000..8f5f847eaab --- /dev/null +++ b/source/blender/freestyle/intern/scene_graph/SceneHash.h @@ -0,0 +1,67 @@ +/* + * ***** 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. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef __FREESTYLE_SCENE_HASH_H__ +#define __FREESTYLE_SCENE_HASH_H__ + +/** \file blender/freestyle/intern/scene_graph/SceneHash.h + * \ingroup freestyle + */ + +#include "IndexedFaceSet.h" +#include "SceneVisitor.h" + +#ifdef WITH_CXX_GUARDEDALLOC +#include "MEM_guardedalloc.h" +#endif + +namespace Freestyle { + +class SceneHash : public SceneVisitor +{ +public: + inline SceneHash() : SceneVisitor() + { + _hashcode = 0.0; + } + + virtual ~SceneHash() {} + + VISIT_DECL(IndexedFaceSet) + + inline real getValue() { + return _hashcode; + } + + inline void reset() { + _hashcode = 0.0; + } + +private: + real _hashcode; + +#ifdef WITH_CXX_GUARDEDALLOC + MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:SceneHash") +#endif +}; + +} /* namespace Freestyle */ + +#endif // __FREESTYLE_SCENE_HASH_H__ diff --git a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp index b7b5eb4162b..69ca45d3ec7 100644 --- a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp +++ b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp @@ -808,9 +808,10 @@ int BezierCurveShader::shade(Stroke& stroke) const ++it) { (it)->setAttribute(*a); - if ((index <= index1) || (index > index2)) + if ((index <= index1) || (index > index2)) { ++a; - ++index; + } + ++index; } return 0; } diff --git a/source/blender/freestyle/intern/stroke/Chain.cpp b/source/blender/freestyle/intern/stroke/Chain.cpp index 7fd756472b0..0e8c2c9ae6f 100644 --- a/source/blender/freestyle/intern/stroke/Chain.cpp +++ b/source/blender/freestyle/intern/stroke/Chain.cpp @@ -59,6 +59,7 @@ void Chain::push_viewedge_back(ViewEdge *iViewEdge, bool orientation) CurvePoint *cp = _Vertices.back(); // assumed to be instantiated as new CurvePoint(iSVertex, 0, 0.f); SVertex *sv_first = (*vfirst); FEdge *fe = _fedgeB->duplicate(); + fe->setTemporary(true); fe->setVertexB(sv_first); fe->vertexA()->shape()->AddEdge(fe); fe->vertexA()->AddFEdge(fe); @@ -119,6 +120,7 @@ void Chain::push_viewedge_front(ViewEdge *iViewEdge, bool orientation) SVertex *sv_curr = (*v); FEdge *fe = (orientation) ? iViewEdge->fedgeA() : iViewEdge->fedgeB(); FEdge *fe2 = fe->duplicate(); + fe2->setTemporary(true); fe2->setVertexA(sv_curr); fe2->setVertexB(sv_last); sv_last->AddFEdge(fe2); diff --git a/source/blender/freestyle/intern/stroke/Chain.h b/source/blender/freestyle/intern/stroke/Chain.h index 95e825e270b..6cf3a7199bf 100644 --- a/source/blender/freestyle/intern/stroke/Chain.h +++ b/source/blender/freestyle/intern/stroke/Chain.h @@ -106,6 +106,10 @@ public: { return _splittingId; } + +#ifdef WITH_CXX_GUARDEDALLOC + MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Chain") +#endif }; } /* namespace Freestyle */ diff --git a/source/blender/freestyle/intern/stroke/Curve.h b/source/blender/freestyle/intern/stroke/Curve.h index 6b799c921a4..726b238c74b 100644 --- a/source/blender/freestyle/intern/stroke/Curve.h +++ b/source/blender/freestyle/intern/stroke/Curve.h @@ -341,6 +341,10 @@ public: real curvatureFredo() const; Vec2d directionFredo() const; #endif + +#ifdef WITH_CXX_GUARDEDALLOC + MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:CurvePoint") +#endif }; @@ -586,6 +590,10 @@ public: * At each iteration a virtual temporary CurvePoint is created. */ virtual Interface0DIterator pointsEnd(float t = 0.0f); + +#ifdef WITH_CXX_GUARDEDALLOC + MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Curve") +#endif }; } /* namespace Freestyle */ diff --git a/source/blender/freestyle/intern/stroke/Operators.cpp b/source/blender/freestyle/intern/stroke/Operators.cpp index 427994f80f1..87ba34e8f42 100644 --- a/source/blender/freestyle/intern/stroke/Operators.cpp +++ b/source/blender/freestyle/intern/stroke/Operators.cpp @@ -1242,7 +1242,7 @@ error: return -1; } -void Operators::reset() +void Operators::reset(bool removeStrokes) { ViewMap *vm = ViewMap::getInstance(); if (!vm) { @@ -1253,11 +1253,7 @@ void Operators::reset() for (I1DContainer::iterator it = _current_chains_set.begin(); it != _current_chains_set.end(); ++it) delete *it; _current_chains_set.clear(); -#if 0 - _current_view_edges_set.insert(_current_view_edges_set.begin(), - vm->ViewEdges().begin(), - vm->ViewEdges().end()); -#else + ViewMap::viewedges_container& vedges = vm->ViewEdges(); ViewMap::viewedges_container::iterator ve = vedges.begin(), veend = vedges.end(); for (; ve != veend; ++ve) { @@ -1265,9 +1261,9 @@ void Operators::reset() continue; _current_view_edges_set.push_back(*ve); } -#endif _current_set = &_current_view_edges_set; - _current_strokes_set.clear(); + if (removeStrokes) + _current_strokes_set.clear(); } } /* namespace Freestyle */ diff --git a/source/blender/freestyle/intern/stroke/Operators.h b/source/blender/freestyle/intern/stroke/Operators.h index 59ebec57246..c7b0e3f8b81 100644 --- a/source/blender/freestyle/intern/stroke/Operators.h +++ b/source/blender/freestyle/intern/stroke/Operators.h @@ -259,7 +259,7 @@ public: return &_current_strokes_set; } - static void reset(); + static void reset(bool removeStrokes=true); private: Operators() {} diff --git a/source/blender/freestyle/intern/stroke/Stroke.h b/source/blender/freestyle/intern/stroke/Stroke.h index 86c667a38b6..8ff801ed144 100644 --- a/source/blender/freestyle/intern/stroke/Stroke.h +++ b/source/blender/freestyle/intern/stroke/Stroke.h @@ -474,6 +474,10 @@ public: /* interface definition */ /* inherited */ + +#ifdef WITH_CXX_GUARDEDALLOC + MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:StrokeVertex") +#endif }; @@ -862,6 +866,10 @@ public: virtual Interface0DIterator pointsBegin(float t = 0.0f); virtual Interface0DIterator pointsEnd(float t = 0.0f); + +#ifdef WITH_CXX_GUARDEDALLOC + MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Stroke") +#endif }; diff --git a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp index 9c9cd88f188..a5e526fc490 100644 --- a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp +++ b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp @@ -63,14 +63,14 @@ void FEdgeXDetector::processShapes(WingedEdge& we) WXFace *wxf = dynamic_cast<WXFace*>(*wf); wxf->Clear(); } - _computeViewIndependant = true; + _computeViewIndependent = true; } - else if (!(wxs)->getComputeViewIndependantFlag()) { + else if (!(wxs)->getComputeViewIndependentFlag()) { wxs->Reset(); - _computeViewIndependant = false; + _computeViewIndependent = false; } else { - _computeViewIndependant = true; + _computeViewIndependent = true; } preProcessShape(wxs); if (progressBarDisplay) @@ -97,8 +97,8 @@ void FEdgeXDetector::processShapes(WingedEdge& we) if (progressBarDisplay) _pProgressBar->setProgress(_pProgressBar->getProgress() + 1); - wxs->setComputeViewIndependantFlag(false); - _computeViewIndependant = false; + wxs->setComputeViewIndependentFlag(false); + _computeViewIndependent = false; _changes = false; // reset user data @@ -187,8 +187,8 @@ void FEdgeXDetector::computeCurvatures(WXVertex *vertex) CurvatureInfo *C; float radius = _sphereRadius * _meanEdgeSize; - // view independant stuff - if (_computeViewIndependant) { + // view independent stuff + if (_computeViewIndependent) { C = new CurvatureInfo(); vertex->setCurvatures(C); OGF::NormalCycle ncycle; @@ -333,7 +333,7 @@ void FEdgeXDetector::ProcessSilhouetteEdge(WXEdge *iEdge) ///////// void FEdgeXDetector::processBorderShape(WXShape *iWShape) { - if (!_computeViewIndependant) + if (!_computeViewIndependent) return; // Make a pass on the edges to detect the BORDER vector<WEdge*>::iterator we, weend; @@ -358,7 +358,7 @@ void FEdgeXDetector::ProcessBorderEdge(WXEdge *iEdge) ///////// void FEdgeXDetector::processCreaseShape(WXShape *iWShape) { - if (!_computeViewIndependant) + if (!_computeViewIndependent) return; // Make a pass on the edges to detect the CREASE @@ -390,7 +390,7 @@ void FEdgeXDetector::processRidgesAndValleysShape(WXShape *iWShape) // Don't forget to add the built layer to the face at the end of the ProcessFace: //iFace->AddSmoothLayer(faceLayer); - if (!_computeViewIndependant) + if (!_computeViewIndependent) return; // Here the curvatures must already have been computed @@ -684,7 +684,7 @@ void FEdgeXDetector::postProcessSuggestiveContourFace(WXFace *iFace) //////////////////// void FEdgeXDetector::processMaterialBoundaryShape(WXShape *iWShape) { - if (!_computeViewIndependant) + if (!_computeViewIndependent) return; // Make a pass on the edges to detect material boundaries vector<WEdge*>::iterator we, weend; diff --git a/source/blender/freestyle/intern/view_map/FEdgeXDetector.h b/source/blender/freestyle/intern/view_map/FEdgeXDetector.h index 8adf685a6eb..8170fc5baab 100644 --- a/source/blender/freestyle/intern/view_map/FEdgeXDetector.h +++ b/source/blender/freestyle/intern/view_map/FEdgeXDetector.h @@ -57,7 +57,7 @@ public: { _pProgressBar = NULL; _pRenderMonitor = NULL; - _computeViewIndependant = true; + _computeViewIndependent = true; _bbox_diagonal = 1.0; _meanEdgeSize = 0; _computeRidgesAndValleys = true; @@ -213,7 +213,7 @@ protected: Vec3r _Viewpoint; real _bbox_diagonal; // diagonal of the current processed shape bbox //oldtmp values - bool _computeViewIndependant; + bool _computeViewIndependent; real _meanK1; real _meanKr; real _minK1; diff --git a/source/blender/freestyle/intern/view_map/Silhouette.h b/source/blender/freestyle/intern/view_map/Silhouette.h index d838b98c1a8..94b00157ccd 100644 --- a/source/blender/freestyle/intern/view_map/Silhouette.h +++ b/source/blender/freestyle/intern/view_map/Silhouette.h @@ -378,6 +378,17 @@ public: _FEdges.push_back(iFEdge); } + /*! Remove an FEdge from the list of edges emanating from this SVertex. */ + inline void RemoveFEdge(FEdge *iFEdge) + { + for (vector<FEdge *>::iterator fe = _FEdges.begin(), fend = _FEdges.end(); fe != fend; fe++) { + if (iFEdge == (*fe)) { + _FEdges.erase(fe); + break; + } + } + } + /* replaces edge 1 by edge 2 in the list of edges */ inline void Replace(FEdge *e1, FEdge *e2) { @@ -441,6 +452,10 @@ public: /*! angle in radians */ inline real curvature2d_as_angle() const; #endif + +#ifdef WITH_CXX_GUARDEDALLOC + MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:SVertex") +#endif }; /**********************************/ @@ -518,6 +533,8 @@ protected: bool _isInImage; + bool _isTemporary; + public: /*! A field that can be used by the user to store any data. * This field must be reseted afterwards using ResetUserData(). @@ -538,6 +555,7 @@ public: _occludeeEmpty = true; _isSmooth = false; _isInImage = true; + _isTemporary = false; } /*! Builds an FEdge going from vA to vB. */ @@ -554,6 +572,7 @@ public: _occludeeEmpty = true; _isSmooth = false; _isInImage = true; + _isTemporary = false; } /*! Copy constructor */ @@ -573,6 +592,7 @@ public: _occludeeEmpty = iBrother._occludeeEmpty; _isSmooth = iBrother._isSmooth; _isInImage = iBrother._isInImage; + _isTemporary = iBrother._isTemporary; iBrother.userdata = this; userdata = 0; } @@ -708,6 +728,11 @@ public: return _isInImage; } + inline bool isTemporary() const + { + return _isTemporary; + } + /* modifiers */ /*! Sets the first SVertex. */ inline void setVertexA(SVertex *vA) @@ -803,6 +828,11 @@ public: _isInImage = iFlag; } + inline void setTemporary(bool iFlag) + { + _isTemporary = iFlag; + } + /* checks whether two FEdge have a common vertex. * Returns a pointer on the common vertex if it exists, NULL otherwise. */ @@ -931,6 +961,10 @@ public: * The sampling with which we want to iterate over points of this FEdge. */ virtual inline Interface0DIterator pointsEnd(float t = 0.0f); + +#ifdef WITH_CXX_GUARDEDALLOC + MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:FEdge") +#endif }; // @@ -1241,6 +1275,10 @@ public: { _bFaceMark = iFaceMark; } + +#ifdef WITH_CXX_GUARDEDALLOC + MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:FEdgeSharp") +#endif }; /*! Class defining a smooth edge. This kind of edge typically runs across a face of the input mesh. It can be @@ -1353,6 +1391,10 @@ public: { _FrsMaterialIndex = i; } + +#ifdef WITH_CXX_GUARDEDALLOC + MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:FEdgeSmooth") +#endif }; diff --git a/source/blender/freestyle/intern/view_map/ViewMap.cpp b/source/blender/freestyle/intern/view_map/ViewMap.cpp index fd5ebb99f72..6bb0082e379 100644 --- a/source/blender/freestyle/intern/view_map/ViewMap.cpp +++ b/source/blender/freestyle/intern/view_map/ViewMap.cpp @@ -63,6 +63,30 @@ ViewMap::~ViewMap() _VEdges.clear(); } +void ViewMap::Clean() +{ + vector<FEdge*> tmpEdges; + + for (vector<ViewShape*>::iterator vs = _VShapes.begin(), vsend = _VShapes.end(); vs != vsend; vs++) { + vector<FEdge*>& edges = (*vs)->sshape()->getEdgeList(); + for (vector<FEdge*>::iterator it = edges.begin(), itend = edges.end(); it != itend; it++) { + if ((*it)->isTemporary()) { + (*it)->setTemporary(false); // avoid being counted multiple times + tmpEdges.push_back(*it); + } + } + } + + for (vector<FEdge*>::iterator it = tmpEdges.begin(), itend = tmpEdges.end(); it != itend; it++) { + for (vector<ViewShape*>::iterator vs = _VShapes.begin(), vsend = _VShapes.end(); vs != vsend; vs++) { + (*vs)->sshape()->RemoveEdge(*it); + } + (*it)->vertexA()->RemoveFEdge(*it); + (*it)->vertexB()->RemoveFEdge(*it); + delete (*it); + } +} + ViewShape *ViewMap::viewShape(unsigned id) { int index = _shapeIdToIndex[id]; diff --git a/source/blender/freestyle/intern/view_map/ViewMap.h b/source/blender/freestyle/intern/view_map/ViewMap.h index d87341503fa..0ee1864e086 100644 --- a/source/blender/freestyle/intern/view_map/ViewMap.h +++ b/source/blender/freestyle/intern/view_map/ViewMap.h @@ -236,6 +236,9 @@ public: /* connects a FEdge to the graph trough a SVertex */ //FEdge *Connect(FEdge *ioEdge, SVertex *ioVertex); + /* Clean temporary FEdges created by chaining */ + virtual void Clean(); + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:ViewMap") #endif @@ -369,7 +372,6 @@ public: #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:ViewVertex") #endif - }; /**********************************/ @@ -642,7 +644,6 @@ public: #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:TVertex") #endif - }; @@ -859,7 +860,6 @@ public: #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:NonTVertex") #endif - }; /**********************************/ @@ -1379,7 +1379,6 @@ public: #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:ViewEdge") #endif - }; diff --git a/source/blender/freestyle/intern/winged_edge/WXEdge.h b/source/blender/freestyle/intern/winged_edge/WXEdge.h index ce9749369fc..3c9ec7a7e3d 100644 --- a/source/blender/freestyle/intern/winged_edge/WXEdge.h +++ b/source/blender/freestyle/intern/winged_edge/WXEdge.h @@ -718,18 +718,18 @@ public: typedef WXShape type_name; protected: - bool _computeViewIndependant; // flag to indicate whether the view independant stuff must be computed or not + bool _computeViewIndependent; // flag to indicate whether the view independent stuff must be computed or not public: inline WXShape() : WShape() { - _computeViewIndependant = true; + _computeViewIndependent = true; } /*! copy constructor */ inline WXShape(WXShape& iBrother) : WShape(iBrother) { - _computeViewIndependant = iBrother._computeViewIndependant; + _computeViewIndependent = iBrother._computeViewIndependent; } virtual WShape *duplicate() @@ -740,14 +740,14 @@ public: virtual ~WXShape() {} - inline bool getComputeViewIndependantFlag() const + inline bool getComputeViewIndependentFlag() const { - return _computeViewIndependant; + return _computeViewIndependent; } - inline void setComputeViewIndependantFlag(bool iFlag) + inline void setComputeViewIndependentFlag(bool iFlag) { - _computeViewIndependant = iFlag; + _computeViewIndependent = iFlag; } /*! designed to build a specialized WFace for use in MakeFace */ diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index ca8997913bf..04f8e68431a 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -719,9 +719,12 @@ void GPU_invalid_tex_bind(int mode) void GPU_invalid_tex_free(void) { - GPU_texture_free(GG.invalid_tex_1D); - GPU_texture_free(GG.invalid_tex_2D); - GPU_texture_free(GG.invalid_tex_3D); + if (GG.invalid_tex_1D) + GPU_texture_free(GG.invalid_tex_1D); + if (GG.invalid_tex_2D) + GPU_texture_free(GG.invalid_tex_2D); + if (GG.invalid_tex_3D) + GPU_texture_free(GG.invalid_tex_3D); } diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index 6578f4b9697..f91fd7a8c1e 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -737,8 +737,9 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la i = is; GPU_link(mat, "shade_visifac", i, visifac, shi->refl, &i); - GPU_link(mat, "set_value", GPU_dynamic_uniform(lamp->dyncol, GPU_DYNAMIC_LAMP_DYNCOL, lamp->ob), &lcol); + GPU_link(mat, "set_rgb", GPU_dynamic_uniform(lamp->dyncol, GPU_DYNAMIC_LAMP_DYNCOL, lamp->ob), &lcol); shade_light_textures(mat, lamp, &lcol); + GPU_link(mat, "shade_mul_value_v3", GPU_dynamic_uniform(&lamp->dynenergy, GPU_DYNAMIC_LAMP_DYNENERGY, lamp->ob), lcol, &lcol); #if 0 if (ma->mode & MA_TANGENT_VN) @@ -1714,9 +1715,9 @@ void GPU_lamp_update_colors(GPULamp *lamp, float r, float g, float b, float ener lamp->energy = energy; if (lamp->mode & LA_NEG) lamp->energy= -lamp->energy; - lamp->col[0]= r* lamp->energy; - lamp->col[1]= g* lamp->energy; - lamp->col[2]= b* lamp->energy; + lamp->col[0]= r; + lamp->col[1]= g; + lamp->col[2]= b; } void GPU_lamp_update_distance(GPULamp *lamp, float distance, float att1, float att2) @@ -1748,9 +1749,9 @@ static void gpu_lamp_from_blender(Scene *scene, Object *ob, Object *par, Lamp *l lamp->energy = la->energy; if (lamp->mode & LA_NEG) lamp->energy= -lamp->energy; - lamp->col[0]= la->r*lamp->energy; - lamp->col[1]= la->g*lamp->energy; - lamp->col[2]= la->b*lamp->energy; + lamp->col[0]= la->r; + lamp->col[1]= la->g; + lamp->col[2]= la->b; GPU_lamp_update(lamp, ob->lay, (ob->restrictflag & OB_RESTRICT_RENDER), ob->obmat); @@ -2013,6 +2014,7 @@ GPUNodeLink *GPU_lamp_get_data(GPUMaterial *mat, GPULamp *lamp, GPUNodeLink **co *col = GPU_dynamic_uniform(lamp->dyncol, GPU_DYNAMIC_LAMP_DYNCOL, lamp->ob); visifac = lamp_get_visibility(mat, lamp, lv, dist); + /* looks like it's not used? psy-fi */ shade_light_textures(mat, lamp, col); if (GPU_lamp_has_shadow_buffer(lamp)) { diff --git a/source/blender/gpu/intern/gpu_select.c b/source/blender/gpu/intern/gpu_select.c index da92c52d62c..afd6af9efae 100644 --- a/source/blender/gpu/intern/gpu_select.c +++ b/source/blender/gpu/intern/gpu_select.c @@ -126,7 +126,7 @@ void GPU_select_begin(unsigned int *buffer, unsigned int bufsize, rctf *input, c } else if (mode == GPU_SELECT_NEAREST_SECOND_PASS) { glEnable(GL_DEPTH_TEST); - glDepthMask(GL_TRUE); + glDepthMask(GL_FALSE); glDepthFunc(GL_EQUAL); } } diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl index 3ba36c11311..23716c8105d 100644 --- a/source/blender/gpu/shaders/gpu_shader_material.glsl +++ b/source/blender/gpu/shaders/gpu_shader_material.glsl @@ -1960,6 +1960,11 @@ void shade_mul_value(float fac, vec4 col, out vec4 outcol) outcol = col*fac; } +void shade_mul_value_v3(float fac, vec3 col, out vec3 outcol) +{ + outcol = col*fac; +} + void shade_obcolor(vec4 col, vec4 obcol, out vec4 outcol) { outcol = vec4(col.rgb*obcol.rgb, col.a); diff --git a/source/blender/ikplugin/intern/itasc_plugin.cpp b/source/blender/ikplugin/intern/itasc_plugin.cpp index 5077ccec256..afff97a8409 100644 --- a/source/blender/ikplugin/intern/itasc_plugin.cpp +++ b/source/blender/ikplugin/intern/itasc_plugin.cpp @@ -68,7 +68,7 @@ extern "C" { #include "itasc_plugin.h" // default parameters -bItasc DefIKParam; +static bItasc DefIKParam; // in case of animation mode, feedback and timestep is fixed // #define ANIM_TIMESTEP 1.0 diff --git a/source/blender/imbuf/intern/cache.c b/source/blender/imbuf/intern/cache.c index 0c17dd21434..677c3dbe700 100644 --- a/source/blender/imbuf/intern/cache.c +++ b/source/blender/imbuf/intern/cache.c @@ -101,14 +101,14 @@ static unsigned int imb_global_tile_hash(const void *gtile_p) return ((unsigned int)(intptr_t)gtile->ibuf) * 769 + gtile->tx * 53 + gtile->ty * 97; } -static int imb_global_tile_cmp(const void *a_p, const void *b_p) +static bool imb_global_tile_cmp(const void *a_p, const void *b_p) { const ImGlobalTile *a = a_p; const ImGlobalTile *b = b_p; - if (a->ibuf == b->ibuf && a->tx == b->tx && a->ty == b->ty) return 0; - else if (a->ibuf < b->ibuf || a->tx < b->tx || a->ty < b->ty) return -1; - else return 1; + return ((a->ibuf != b->ibuf) || + (a->tx != b->tx) || + (a->ty != b->ty)); } static unsigned int imb_thread_tile_hash(const void *ttile_p) @@ -118,14 +118,14 @@ static unsigned int imb_thread_tile_hash(const void *ttile_p) return ((unsigned int)(intptr_t)ttile->ibuf) * 769 + ttile->tx * 53 + ttile->ty * 97; } -static int imb_thread_tile_cmp(const void *a_p, const void *b_p) +static bool imb_thread_tile_cmp(const void *a_p, const void *b_p) { const ImThreadTile *a = a_p; const ImThreadTile *b = b_p; - if (a->ibuf == b->ibuf && a->tx == b->tx && a->ty == b->ty) return 0; - else if (a->ibuf < b->ibuf || a->tx < b->tx || a->ty < b->ty) return -1; - else return 1; + return ((a->ibuf != b->ibuf) || + (a->tx != b->tx) || + (a->ty != b->ty)); } /******************************** Load/Unload ********************************/ diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c index 06dd128137b..5dd6b366a93 100644 --- a/source/blender/imbuf/intern/colormanagement.c +++ b/source/blender/imbuf/intern/colormanagement.c @@ -252,22 +252,13 @@ static unsigned int colormanage_hashhash(const void *key_v) return rval; } -static int colormanage_hashcmp(const void *av, const void *bv) +static bool colormanage_hashcmp(const void *av, const void *bv) { const ColormanageCacheKey *a = (ColormanageCacheKey *) av; const ColormanageCacheKey *b = (ColormanageCacheKey *) bv; - if (a->view < b->view) - return -1; - else if (a->view > b->view) - return 1; - - if (a->display < b->display) - return -1; - else if (a->display > b->display) - return 1; - - return 0; + return ((a->view != b->view) || + (a->display != b->display)); } static struct MovieCache *colormanage_moviecache_ensure(ImBuf *ibuf) diff --git a/source/blender/imbuf/intern/moviecache.c b/source/blender/imbuf/intern/moviecache.c index ea75673e5f0..1641bd3089b 100644 --- a/source/blender/imbuf/intern/moviecache.c +++ b/source/blender/imbuf/intern/moviecache.c @@ -104,7 +104,7 @@ static unsigned int moviecache_hashhash(const void *keyv) return key->cache_owner->hashfp(key->userkey); } -static int moviecache_hashcmp(const void *av, const void *bv) +static bool moviecache_hashcmp(const void *av, const void *bv) { const MovieCacheKey *a = (MovieCacheKey *)av; const MovieCacheKey *b = (MovieCacheKey *)bv; diff --git a/source/blender/imbuf/intern/readimage.c b/source/blender/imbuf/intern/readimage.c index f0bcfcea62d..bb09c57d1e5 100644 --- a/source/blender/imbuf/intern/readimage.c +++ b/source/blender/imbuf/intern/readimage.c @@ -58,7 +58,7 @@ static void imb_handle_alpha(ImBuf *ibuf, int flags, char colorspace[IM_MAX_SPAC int alpha_flags; if (colorspace) { - if (ibuf->rect) { + if (ibuf->rect != NULL && ibuf->rect_float == NULL) { /* byte buffer is never internally converted to some standard space, * store pointer to it's color space descriptor instead */ diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index 8483e5f08f9..33d1445fb93 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -182,7 +182,7 @@ typedef struct PreviewImage { #define ID_CU MAKE_ID2('C', 'U') /* Curve */ #define ID_MB MAKE_ID2('M', 'B') /* MetaBall */ #define ID_MA MAKE_ID2('M', 'A') /* Material */ -#define ID_TE MAKE_ID2('T', 'E') /* Texture */ +#define ID_TE MAKE_ID2('T', 'E') /* Tex (Texture) */ #define ID_IM MAKE_ID2('I', 'M') /* Image */ #define ID_LT MAKE_ID2('L', 'T') /* Lattice */ #define ID_LA MAKE_ID2('L', 'A') /* Lamp */ @@ -192,25 +192,25 @@ typedef struct PreviewImage { #define ID_WO MAKE_ID2('W', 'O') /* World */ #define ID_SCR MAKE_ID2('S', 'R') /* Screen */ #define ID_SCRN MAKE_ID2('S', 'N') /* (depreciated?) */ -#define ID_VF MAKE_ID2('V', 'F') /* VectorFont */ +#define ID_VF MAKE_ID2('V', 'F') /* VFont (Vector Font) */ #define ID_TXT MAKE_ID2('T', 'X') /* Text */ #define ID_SPK MAKE_ID2('S', 'K') /* Speaker */ #define ID_SO MAKE_ID2('S', 'O') /* Sound */ #define ID_GR MAKE_ID2('G', 'R') /* Group */ #define ID_ID MAKE_ID2('I', 'D') /* (internal use only) */ -#define ID_AR MAKE_ID2('A', 'R') /* Armature */ -#define ID_AC MAKE_ID2('A', 'C') /* Action */ +#define ID_AR MAKE_ID2('A', 'R') /* bArmature */ +#define ID_AC MAKE_ID2('A', 'C') /* bAction */ #define ID_SCRIPT MAKE_ID2('P', 'Y') /* Script (depreciated) */ -#define ID_NT MAKE_ID2('N', 'T') /* NodeTree */ +#define ID_NT MAKE_ID2('N', 'T') /* bNodeTree */ #define ID_BR MAKE_ID2('B', 'R') /* Brush */ #define ID_PA MAKE_ID2('P', 'A') /* ParticleSettings */ -#define ID_GD MAKE_ID2('G', 'D') /* GreasePencil */ +#define ID_GD MAKE_ID2('G', 'D') /* bGPdata, (Grease Pencil) */ #define ID_WM MAKE_ID2('W', 'M') /* WindowManager */ #define ID_MC MAKE_ID2('M', 'C') /* MovieClip */ #define ID_MSK MAKE_ID2('M', 'S') /* Mask */ #define ID_LS MAKE_ID2('L', 'S') /* FreestyleLineStyle */ #define ID_PAL MAKE_ID2('P', 'L') /* Palette */ -#define ID_PC MAKE_ID2('P', 'C') /* Paint Curve */ +#define ID_PC MAKE_ID2('P', 'C') /* PaintCurve */ /* NOTE! Fake IDs, needed for g.sipo->blocktype or outliner */ #define ID_SEQ MAKE_ID2('S', 'Q') diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h index 9fbd70419f4..b14861fcf47 100644 --- a/source/blender/makesdna/DNA_brush_types.h +++ b/source/blender/makesdna/DNA_brush_types.h @@ -153,8 +153,8 @@ typedef struct Palette ListBase colors; ListBase deleted; - int num_of_colours; int active_color; + int pad; } Palette; typedef struct PaintCurvePoint diff --git a/source/blender/makesdna/DNA_freestyle_types.h b/source/blender/makesdna/DNA_freestyle_types.h index 195c7eb4841..d099511a088 100644 --- a/source/blender/makesdna/DNA_freestyle_types.h +++ b/source/blender/makesdna/DNA_freestyle_types.h @@ -50,6 +50,7 @@ struct Text; #define FREESTYLE_FACE_SMOOTHNESS_FLAG (1 << 3) #define FREESTYLE_ADVANCED_OPTIONS_FLAG (1 << 4) #define FREESTYLE_CULLING (1 << 5) +#define FREESTYLE_VIEW_MAP_CACHE (1 << 6) /* FreestyleConfig::mode */ #define FREESTYLE_CONTROL_SCRIPT_MODE 1 diff --git a/source/blender/makesdna/DNA_image_types.h b/source/blender/makesdna/DNA_image_types.h index 0b9dddd0ea5..b66772f0bb9 100644 --- a/source/blender/makesdna/DNA_image_types.h +++ b/source/blender/makesdna/DNA_image_types.h @@ -109,6 +109,7 @@ typedef struct Image { int gen_x, gen_y; char gen_type, gen_flag; short gen_depth; + float gen_color[4]; /* display aspect - for UV editing images resized for faster openGL display */ float aspx, aspy; diff --git a/source/blender/makesdna/DNA_lamp_types.h b/source/blender/makesdna/DNA_lamp_types.h index b7aae005e3b..a920182d5a3 100644 --- a/source/blender/makesdna/DNA_lamp_types.h +++ b/source/blender/makesdna/DNA_lamp_types.h @@ -131,26 +131,26 @@ typedef struct Lamp { #define LA_YF_PHOTON 5 /* mode */ -#define LA_SHAD_BUF 1 -#define LA_HALO 2 -#define LA_LAYER 4 -#define LA_QUAD 8 /* no longer used */ -#define LA_NEG 16 -#define LA_ONLYSHADOW 32 -#define LA_SPHERE 64 -#define LA_SQUARE 128 -#define LA_TEXTURE 256 -#define LA_OSATEX 512 -/* #define LA_DEEP_SHADOW 1024 */ /* not used anywhere */ -#define LA_NO_DIFF 2048 -#define LA_NO_SPEC 4096 -#define LA_SHAD_RAY 8192 +#define LA_SHAD_BUF (1 << 0) +#define LA_HALO (1 << 1) +#define LA_LAYER (1 << 2) +#define LA_QUAD (1 << 3) /* no longer used */ +#define LA_NEG (1 << 4) +#define LA_ONLYSHADOW (1 << 5) +#define LA_SPHERE (1 << 6) +#define LA_SQUARE (1 << 7) +#define LA_TEXTURE (1 << 8) +#define LA_OSATEX (1 << 9) +/* #define LA_DEEP_SHADOW (1 << 10) */ /* not used anywhere */ +#define LA_NO_DIFF (1 << 11) +#define LA_NO_SPEC (1 << 12) +#define LA_SHAD_RAY (1 << 13) /* yafray: lamp shadowbuffer flag, softlight */ /* Since it is used with LOCAL lamp, can't use LA_SHAD */ -/* #define LA_YF_SOFT 16384 */ /* no longer used */ -#define LA_LAYER_SHADOW 32768 -#define LA_SHAD_TEX (1<<16) -#define LA_SHOW_CONE (1<<17) +/* #define LA_YF_SOFT (1 << 14) */ /* no longer used */ +#define LA_LAYER_SHADOW (1 << 15) +#define LA_SHAD_TEX (1 << 16) +#define LA_SHOW_CONE (1 << 17) /* layer_shadow */ #define LA_LAYER_SHADOW_BOTH 0 diff --git a/source/blender/makesdna/DNA_linestyle_types.h b/source/blender/makesdna/DNA_linestyle_types.h index bac03b4efd7..262bcb5981a 100644 --- a/source/blender/makesdna/DNA_linestyle_types.h +++ b/source/blender/makesdna/DNA_linestyle_types.h @@ -387,6 +387,7 @@ typedef struct LineStyleThicknessModifier_Calligraphy { #define LS_NO_SORTING (1 << 11) #define LS_REVERSE_ORDER (1 << 12) /* for sorting */ #define LS_TEXTURE (1 << 13) +#define LS_CHAIN_COUNT (1 << 14) /* FreestyleLineStyle::chaining */ #define LS_CHAINING_PLAIN 1 @@ -406,6 +407,8 @@ typedef struct LineStyleThicknessModifier_Calligraphy { /* FreestyleLineStyle::sort_key */ #define LS_SORT_KEY_DISTANCE_FROM_CAMERA 1 #define LS_SORT_KEY_2D_LENGTH 2 +#define LS_SORT_KEY_PROJECTED_X 3 +#define LS_SORT_KEY_PROJECTED_Y 4 /* FreestyleLineStyle::integration_type */ #define LS_INTEGRATION_MEAN 1 @@ -428,13 +431,14 @@ typedef struct FreestyleLineStyle { float split_length; float min_angle, max_angle; /* in radians, for splitting */ float min_length, max_length; + unsigned int chain_count; unsigned short split_dash1, split_gap1; unsigned short split_dash2, split_gap2; unsigned short split_dash3, split_gap3; int sort_key, integration_type; float texstep; short texact, pr_texture; - short use_nodes, pad; + short use_nodes, pad[3]; unsigned short dash1, gap1, dash2, gap2, dash3, gap3; int panel; /* for UI */ diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index c8b8e4d52a4..f8f962107f6 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -242,6 +242,7 @@ typedef enum ScenePassType { SCE_PASS_SUBSURFACE_DIRECT = (1 << 28), SCE_PASS_SUBSURFACE_INDIRECT = (1 << 29), SCE_PASS_SUBSURFACE_COLOR = (1 << 30), + SCE_PASS_DEBUG = (1 << 31), /* This is a virtual pass. */ } ScenePassType; /* note, srl->passflag is treestore element 'nr' in outliner, short still... */ @@ -835,7 +836,7 @@ typedef struct Paint { typedef struct ImagePaintSettings { Paint paint; - short flag, pad; + short flag, missing_data; /* for projection painting only */ short seam_bleed, normal_angle; @@ -1733,6 +1734,11 @@ typedef enum ImagePaintMode { #define IMAGEPAINT_PROJECT_LAYER_STENCIL 256 #define IMAGEPAINT_PROJECT_LAYER_STENCIL_INV 512 +#define IMAGEPAINT_MISSING_UVS (1 << 0) +#define IMAGEPAINT_MISSING_MATERIAL (1 << 1) +#define IMAGEPAINT_MISSING_TEX (1 << 2) +#define IMAGEPAINT_MISSING_STENCIL (1 << 3) + /* toolsettings->uvcalc_flag */ #define UVCALC_FILLHOLES 1 #define UVCALC_NO_ASPECT_CORRECT 2 /* would call this UVCALC_ASPECT_CORRECT, except it should be default with old file */ diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 6f57f549efb..a267217abf6 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -57,7 +57,6 @@ struct Scopes; struct Histogram; struct SpaceIpo; struct BlendHandle; -struct RenderInfo; struct bNodeTree; struct uiBlock; struct FileList; diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index ed59014cf75..382fd8c1dbd 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -534,13 +534,13 @@ typedef struct UserDef { float fcu_inactive_alpha; /* opacity of inactive F-Curves in F-Curve Editor */ float pixelsize; /* private, set by GHOST, to multiply DPI with */ + int virtual_pixel; /* virtual pixelsize mode */ short pie_interaction_type; /* if keeping a pie menu spawn button pressed after this time, it turns into * a drag/release pie menu */ short pie_initial_timeout; /* direction in the pie menu will always be calculated from the initial position * within this time limit */ int pie_animation_timeout; - int pad2; short pie_menu_radius; /* pie menu radius */ short pie_menu_threshold; /* pie menu distance from center before a direction is set */ @@ -854,6 +854,11 @@ typedef enum eImageDrawMethod { IMAGE_DRAW_METHOD_DRAWPIXELS = 3, } eImageDrawMethod; +typedef enum eUserpref_VirtualPixel { + VIRTUAL_PIXEL_NATIVE = 0, + VIRTUAL_PIXEL_DOUBLE = 1, +} eUserpref_VirtualPixel; + #ifdef __cplusplus } #endif diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index 98c12e9cc11..3efba488299 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -41,7 +41,6 @@ struct Base; struct BoundBox; struct MovieClip; struct MovieClipUser; -struct RenderInfo; struct RenderEngine; struct bGPdata; struct SmoothView3DStore; @@ -102,7 +101,6 @@ typedef struct RegionView3D { struct BoundBox *clipbb; struct RegionView3D *localvd; /* allocated backup of its self while in localview */ - struct RenderInfo *ri; struct RenderEngine *render_engine; struct ViewDepths *depths; void *gpuoffscreen; diff --git a/source/blender/makesrna/SConscript b/source/blender/makesrna/SConscript index d0af2a522a7..4e7a564e9d4 100644 --- a/source/blender/makesrna/SConscript +++ b/source/blender/makesrna/SConscript @@ -118,6 +118,9 @@ if env['WITH_BF_OCEANSIM']: if env['WITH_BF_CYCLES']: defs.append('WITH_CYCLES') + if env['WITH_BF_CYCLES_DEBUG']: + defs.append('WITH_CYCLES_DEBUG') + if env['WITH_BF_SDL']: defs.append('WITH_SDL') @@ -127,6 +130,10 @@ if env['WITH_BF_OPENAL']: if env['WITH_BF_JACK']: defs.append('WITH_JACK') +if env['WITH_BF_FREESTYLE']: + defs.append('WITH_FREESTYLE') + incs += ' ../freestyle' + if env['OURPLATFORM'] == 'linux': cflags='-pthread' diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index e6bd9fb79b4..9a53ebcec03 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -155,6 +155,9 @@ set(INC_SYS if(WITH_CYCLES) add_definitions(-DWITH_CYCLES) + if(WITH_CYCLES_DEBUG) + add_definitions(-DWITH_CYCLES_DEBUG) + endif() endif() if(WITH_PYTHON) @@ -265,6 +268,9 @@ if(WITH_BULLET) endif() if(WITH_FREESTYLE) + list(APPEND INC + ../../freestyle + ) add_definitions(-DWITH_FREESTYLE) endif() diff --git a/source/blender/makesrna/intern/SConscript b/source/blender/makesrna/intern/SConscript index 4e643fb302f..d1eab5ca9db 100644 --- a/source/blender/makesrna/intern/SConscript +++ b/source/blender/makesrna/intern/SConscript @@ -142,9 +142,12 @@ if env['WITH_BF_COLLADA']: if env['WITH_BF_CYCLES']: defs.append('WITH_CYCLES') + if env['WITH_BF_CYCLES_DEBUG']: + defs.append('WITH_CYCLES_DEBUG') if env['WITH_BF_FREESTYLE']: defs.append('WITH_FREESTYLE') + incs += ' ../../freestyle' if env['OURPLATFORM'] == 'linux': cflags='-pthread' diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index 83fe56102ac..51d81295f8c 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -60,11 +60,14 @@ EnumPropertyItem id_type_items[] = { {ID_LI, "LIBRARY", ICON_LIBRARY_DATA_DIRECT, "Library", ""}, {ID_LS, "LINESTYLE", ICON_LINE_DATA, "Line Style", ""}, {ID_LT, "LATTICE", ICON_LATTICE_DATA, "Lattice", ""}, + {ID_MSK, "MASK", ICON_MOD_MASK, "Mask", ""}, {ID_MA, "MATERIAL", ICON_MATERIAL_DATA, "Material", ""}, {ID_MB, "META", ICON_META_DATA, "MetaBall", ""}, {ID_ME, "MESH", ICON_MESH_DATA, "Mesh", ""}, {ID_NT, "NODETREE", ICON_NODETREE, "NodeTree", ""}, {ID_OB, "OBJECT", ICON_OBJECT_DATA, "Object", ""}, + {ID_PC, "PAINTCURVE", ICON_CURVE_BEZCURVE, "Paint Curve", ""}, + {ID_PAL, "PALETTE", ICON_COLOR, "Palette", ""}, {ID_PA, "PARTICLE", ICON_PARTICLE_DATA, "Particle", ""}, {ID_SCE, "SCENE", ICON_SCENE_DATA, "Scene", ""}, {ID_SCR, "SCREEN", ICON_SPLITSCREEN, "Screen", ""}, diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index 1ff99271146..bbc2e0572fa 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -264,7 +264,7 @@ static int rna_BrushCapabilities_has_spacing_get(PointerRNA *ptr) return (!(br->flag & BRUSH_ANCHORED)); } -static int rna_SculptToolCapabilities_has_strength_get(PointerRNA *ptr) +static int rna_SculptToolCapabilities_has_strength_pressure_get(PointerRNA *ptr) { Brush *br = (Brush *)ptr->data; return !ELEM(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK); @@ -689,7 +689,7 @@ static void rna_def_sculpt_capabilities(BlenderRNA *brna) SCULPT_TOOL_CAPABILITY(has_secondary_color, "Has Secondary Color"); SCULPT_TOOL_CAPABILITY(has_smooth_stroke, "Has Smooth Stroke"); SCULPT_TOOL_CAPABILITY(has_space_attenuation, "Has Space Attenuation"); - SCULPT_TOOL_CAPABILITY(has_strength, "Has Strength"); + SCULPT_TOOL_CAPABILITY(has_strength_pressure, "Has Strength Pressure"); SCULPT_TOOL_CAPABILITY(has_gravity, "Has Gravity"); #undef SCULPT_CAPABILITY diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index 0b129bab524..90c9cd108cd 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -589,6 +589,13 @@ static void rna_def_image(BlenderRNA *brna) RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + prop = RNA_def_property(srna, "generated_color", PROP_FLOAT, PROP_COLOR); + RNA_def_property_float_sdna(prop, NULL, "gen_color"); + RNA_def_property_array(prop, 4); + RNA_def_property_ui_text(prop, "Color", "Fill color for the generated image"); + RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + /* realtime properties */ prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE); RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag"); diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c index 1fb46c009a0..d9a59c4dc55 100644 --- a/source/blender/makesrna/intern/rna_image_api.c +++ b/source/blender/makesrna/intern/rna_image_api.c @@ -115,7 +115,7 @@ static void rna_Image_save(Image *image, bContext *C, ReportList *reports) if (ibuf) { char filename[FILE_MAX]; BLI_strncpy(filename, image->name, sizeof(filename)); - BLI_path_abs(filename, G.main->name); + BLI_path_abs(filename, ID_BLEND_PATH(G.main, &image->id)); if (image->packedfile) { if (writePackedFile(reports, image->name, image->packedfile, 0) != RET_OK) { diff --git a/source/blender/makesrna/intern/rna_linestyle.c b/source/blender/makesrna/intern/rna_linestyle.c index 96b81f12620..2259db1de66 100644 --- a/source/blender/makesrna/intern/rna_linestyle.c +++ b/source/blender/makesrna/intern/rna_linestyle.c @@ -1322,6 +1322,8 @@ static void rna_def_linestyle(BlenderRNA *brna) static EnumPropertyItem sort_key_items[] = { {LS_SORT_KEY_DISTANCE_FROM_CAMERA, "DISTANCE_FROM_CAMERA", 0, "Distance from Camera", "Sort by distance from camera (closer lines lie on top of further lines)"}, {LS_SORT_KEY_2D_LENGTH, "2D_LENGTH", 0, "2D Length", "Sort by curvilinear 2D length (longer lines lie on top of shorter lines)"}, + {LS_SORT_KEY_PROJECTED_X, "PROJECTED_X", 0, "Projected X", "Sort by the projected X value in the image coordinate system"}, + {LS_SORT_KEY_PROJECTED_Y, "PROJECTED_Y", 0, "Projected Y", "Sort by the projected Y value in the image coordinate system"}, {0, NULL, 0, NULL, NULL} }; static EnumPropertyItem sort_order_items[] = { @@ -1488,6 +1490,16 @@ static void rna_def_linestyle(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Max 2D Length", "Maximum curvilinear 2D length for the selection of chains"); RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update"); + prop = RNA_def_property(srna, "use_chain_count", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_CHAIN_COUNT); + RNA_def_property_ui_text(prop, "Use Chain Count", "Enable the selection of first N chains"); + RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update"); + + prop = RNA_def_property(srna, "chain_count", PROP_INT, PROP_UNSIGNED); + RNA_def_property_int_sdna(prop, NULL, "chain_count"); + RNA_def_property_ui_text(prop, "Chain Count", "Chain count for the selection of first N chains"); + RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update"); + prop = RNA_def_property(srna, "use_split_pattern", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_SPLIT_PATTERN); RNA_def_property_ui_text(prop, "Use Split Pattern", "Enable chain splitting by dashed line patterns"); diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 1ef39ec4a77..2e4f24fc0ce 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -204,7 +204,9 @@ static void rna_Material_active_paint_texture_index_update(Main *bmain, Scene *s for (sl = sa->spacedata.first; sl; sl = sl->next) { if (sl->spacetype == SPACE_IMAGE) { SpaceImage *sima = (SpaceImage *)sl; - ED_space_image_set(sima, scene, scene->obedit, image); + + if (!sima->pin) + ED_space_image_set(sima, scene, scene->obedit, image); } } } diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 699bfaa0f93..690468a5278 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -2624,7 +2624,7 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "dupfacesca"); RNA_def_property_range(prop, 0.001f, 10000.0f); RNA_def_property_ui_text(prop, "Dupli Faces Scale", "Scale the DupliFace objects"); - RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); + RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update"); prop = RNA_def_property(srna, "dupli_group", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "dup_group"); diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index 284377d34f9..0ee654d4ecc 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -71,6 +71,9 @@ EnumPropertyItem render_pass_type_items[] = { {SCE_PASS_SUBSURFACE_DIRECT, "SUBSURFACE_DIRECT", 0, "Subsurface Direct", ""}, {SCE_PASS_SUBSURFACE_INDIRECT, "SUBSURFACE_INDIRECT", 0, "Subsurface Indirect", ""}, {SCE_PASS_SUBSURFACE_COLOR, "SUBSURFACE_COLOR", 0, "Subsurface Color", ""}, +#ifdef WITH_CYCLES_DEBUG + {SCE_PASS_DEBUG, "DEBUG", 0, "Pass used for render engine debugging", ""}, +#endif {0, NULL, 0, NULL, NULL} }; @@ -584,6 +587,10 @@ static void rna_def_render_engine(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_PREVIEW); RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); + prop = RNA_def_property(srna, "bl_use_texture_preview", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_TEXTURE_PREVIEW); + RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); + prop = RNA_def_property(srna, "bl_use_postprocess", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "type->flag", RE_USE_POSTPROCESS); RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); @@ -683,6 +690,11 @@ static void rna_def_render_pass(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; + static EnumPropertyItem render_pass_debug_type_items[] = { + {RENDER_PASS_DEBUG_BVH_TRAVERSAL_STEPS, "BVH_TRAVERSAL_STEPS", 0, "BVH Traversal Steps", ""}, + {0, NULL, 0, NULL, NULL} + }; + srna = RNA_def_struct(brna, "RenderPass", NULL); RNA_def_struct_ui_text(srna, "Render Pass", ""); @@ -712,6 +724,11 @@ static void rna_def_render_pass(BlenderRNA *brna) RNA_def_property_dynamic_array_funcs(prop, "rna_RenderPass_rect_get_length"); RNA_def_property_float_funcs(prop, "rna_RenderPass_rect_get", "rna_RenderPass_rect_set", NULL); + prop = RNA_def_property(srna, "debug_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "debug_type"); + RNA_def_property_enum_items(prop, render_pass_debug_type_items); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_define_verify_sdna(1); } diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 682a7f4ee31..70ce87ab68b 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -370,6 +370,10 @@ EnumPropertyItem bake_save_mode_items[] = { #include "RE_engine.h" +#ifdef WITH_FREESTYLE +#include "FRS_freestyle.h" +#endif + static void rna_SpaceImageEditor_uv_sculpt_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr)) { ED_space_image_uv_sculpt_update(bmain->wm.first, scene->toolsettings); @@ -1179,6 +1183,13 @@ static void rna_Scene_freestyle_update(Main *UNUSED(bmain), Scene *UNUSED(scene) DAG_id_tag_update(&scene->id, 0); } +static void rna_Scene_use_view_map_cache_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) +{ +#ifdef WITH_FREESTYLE + FRS_free_view_map_cache(); +#endif +} + static void rna_SceneRenderLayer_name_set(PointerRNA *ptr, const char *value) { Scene *scene = (Scene *)ptr->id.data; @@ -3109,6 +3120,11 @@ static void rna_def_freestyle_settings(BlenderRNA *brna) "Enable advanced edge detection options (sphere radius and Kr derivative epsilon)"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update"); + prop = RNA_def_property(srna, "use_view_map_cache", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_VIEW_MAP_CACHE); + RNA_def_property_ui_text(prop, "View Map Cache", "Keep the computed view map and avoid re-calculating it if mesh geometry is unchanged"); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_use_view_map_cache_update"); + prop = RNA_def_property(srna, "sphere_radius", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "sphere_radius"); RNA_def_property_range(prop, 0.0, 1000.0); @@ -4547,7 +4563,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "alphamode"); RNA_def_property_enum_items(prop, alpha_mode_items); RNA_def_property_ui_text(prop, "Alpha Mode", "Representation of alpha information in the RGBA pixels"); - RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update"); prop = RNA_def_property(srna, "octree_resolution", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "ocres"); @@ -4609,45 +4625,45 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop = RNA_def_property(srna, "use_shadows", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", R_SHADOW); RNA_def_property_ui_text(prop, "Shadows", "Calculate shadows while rendering"); - RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update"); prop = RNA_def_property(srna, "use_envmaps", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", R_ENVMAP); RNA_def_property_ui_text(prop, "Environment Maps", "Calculate environment maps while rendering"); - RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update"); prop = RNA_def_property(srna, "use_sss", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", R_SSS); RNA_def_property_ui_text(prop, "Subsurface Scattering", "Calculate sub-surface scattering in materials rendering"); - RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update"); prop = RNA_def_property(srna, "use_raytrace", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", R_RAYTRACE); RNA_def_property_ui_text(prop, "Raytracing", "Pre-calculate the raytrace accelerator and render raytracing effects"); - RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update"); prop = RNA_def_property(srna, "use_textures", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "scemode", R_NO_TEX); RNA_def_property_ui_text(prop, "Textures", "Use textures to affect material properties"); - RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update"); prop = RNA_def_property(srna, "use_edge_enhance", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", R_EDGE); RNA_def_property_ui_text(prop, "Edge", "Create a toon outline around the edges of geometry"); - RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update"); prop = RNA_def_property(srna, "edge_threshold", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "edgeint"); RNA_def_property_range(prop, 0, 255); RNA_def_property_ui_text(prop, "Edge Threshold", "Threshold for drawing outlines on geometry edges"); - RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update"); prop = RNA_def_property(srna, "edge_color", PROP_FLOAT, PROP_COLOR); RNA_def_property_float_sdna(prop, NULL, "edgeR"); RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Edge Color", "Edge color"); - RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update"); prop = RNA_def_property(srna, "use_freestyle", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", R_EDGE_FRS); diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index d48d8589f96..09e42e48e93 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -308,12 +308,22 @@ static void rna_ImaPaint_mode_update(Main *UNUSED(bmain), Scene *scene, PointerR BKE_texpaint_slots_refresh_object(scene, ob); /* we assume that changing the current mode will invalidate the uv layers so we need to refresh display */ - GPU_drawobject_free(ob->derivedFinal); - WM_main_add_notifier(NC_GEOM | ND_DATA, &ob->id); + GPU_drawobject_free(ob->derivedFinal); + BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL); + WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL); +} + +static void rna_ImaPaint_stencil_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) +{ + Object *ob = OBACT; + GPU_drawobject_free(ob->derivedFinal); + BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL); + WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL); } static void rna_ImaPaint_canvas_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr)) { + Object *ob = OBACT; bScreen *sc; Image *ima = scene->toolsettings->imapaint.canvas; @@ -324,14 +334,23 @@ static void rna_ImaPaint_canvas_update(Main *bmain, Scene *scene, PointerRNA *UN for (sl = sa->spacedata.first; sl; sl = sl->next) { if (sl->spacetype == SPACE_IMAGE) { SpaceImage *sima = (SpaceImage *)sl; - ED_space_image_set(sima, scene, scene->obedit, ima); + + if (!sima->pin) + ED_space_image_set(sima, scene, scene->obedit, ima); } } } } - + + GPU_drawobject_free(ob->derivedFinal); + BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL); WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL); } + +static int rna_ImaPaint_detect_data(ImagePaintSettings *imapaint) +{ + return imapaint->missing_data == 0; +} #else static void rna_def_palettecolor(BlenderRNA *brna) @@ -612,6 +631,7 @@ static void rna_def_image_paint(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; + FunctionRNA *func; static EnumPropertyItem paint_type_items[] = { {IMAGEPAINT_MODE_MATERIAL, "MATERIAL", 0, @@ -625,6 +645,13 @@ static void rna_def_image_paint(BlenderRNA *brna) RNA_def_struct_sdna(srna, "ImagePaintSettings"); RNA_def_struct_path_func(srna, "rna_ImagePaintSettings_path"); RNA_def_struct_ui_text(srna, "Image Paint", "Properties of image and texture painting mode"); + + /* functions */ + func = RNA_def_function(srna, "detect_data", "rna_ImaPaint_detect_data"); + RNA_def_function_ui_description(func, "Check if required texpaint data exist"); + + /* return type */ + RNA_def_function_return(func, RNA_def_boolean(func, "ok", 1, "", "")); /* booleans */ prop = RNA_def_property(srna, "use_occlude", PROP_BOOLEAN, PROP_NONE); @@ -656,7 +683,7 @@ static void rna_def_image_paint(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "stencil"); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Stencil Image", "Image used as stencil"); - RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_viewport_update"); + RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_stencil_update"); prop = RNA_def_property(srna, "canvas", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_EDITABLE); @@ -698,7 +725,32 @@ static void rna_def_image_paint(BlenderRNA *brna) prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, paint_type_items); RNA_def_property_ui_text(prop, "Mode", "Mode of operation for projection painting"); - RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_mode_update"); + RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_mode_update"); + + /* Missing data */ + prop = RNA_def_property(srna, "missing_uvs", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "missing_data", IMAGEPAINT_MISSING_UVS); + RNA_def_property_ui_text(prop, "Missing UVs", + "A UV layer is missing on the mesh"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + + prop = RNA_def_property(srna, "missing_materials", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "missing_data", IMAGEPAINT_MISSING_MATERIAL); + RNA_def_property_ui_text(prop, "Missing Materials", + "The mesh is missing materials"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + + prop = RNA_def_property(srna, "missing_stencil", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "missing_data", IMAGEPAINT_MISSING_STENCIL); + RNA_def_property_ui_text(prop, "Missing Stencil", + "Image Painting does not have a stencil"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + + prop = RNA_def_property(srna, "missing_texture", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "missing_data", IMAGEPAINT_MISSING_TEX); + RNA_def_property_ui_text(prop, "Missing Texture", + "Image Painting does not have a texture to paint on"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); } static void rna_def_particle_edit(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c index 887670eb5ff..55262a98b2e 100644 --- a/source/blender/makesrna/intern/rna_smoke.c +++ b/source/blender/makesrna/intern/rna_smoke.c @@ -311,7 +311,7 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "resolution_max", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "maxres"); - RNA_def_property_range(prop, 24, 512); + RNA_def_property_range(prop, 6, 512); RNA_def_property_ui_range(prop, 24, 512, 2, -1); RNA_def_property_ui_text(prop, "Max Res", "Maximal resolution used in the fluid domain"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index aa378955fb0..7fdc9ba1e79 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -120,6 +120,16 @@ static void rna_userdef_dpi_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Po WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); /* refresh region sizes */ } +static void rna_userdef_virtual_pixel_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) +{ + /* font's are stored at each DPI level, without this we can easy load 100's of fonts */ + BLF_cache_clear(); + + BKE_userdef_state(); + WM_main_add_notifier(NC_WINDOW, NULL); /* full redraw */ + WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); /* refresh region sizes */ +} + static void rna_userdef_language_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) { BLF_cache_clear(); @@ -3743,6 +3753,12 @@ static void rna_def_userdef_system(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; + static EnumPropertyItem virtual_pixel_mode_items[] = { + {VIRTUAL_PIXEL_NATIVE, "NATIVE", 0, "Native", "Use native pixel size of the display"}, + {VIRTUAL_PIXEL_DOUBLE, "DOUBLE", 0, "Double", "Use double the native pixel size of the display"}, + {0, NULL, 0, NULL, NULL} + }; + srna = RNA_def_struct(brna, "UserPreferencesSystem", NULL); RNA_def_struct_sdna(srna, "UserDef"); RNA_def_struct_nested(brna, srna, "UserPreferences"); @@ -3762,6 +3778,12 @@ static void rna_def_userdef_system(BlenderRNA *brna) RNA_def_property_ui_text(prop, "DPI", "Font size and resolution for display"); RNA_def_property_update(prop, 0, "rna_userdef_dpi_update"); + prop = RNA_def_property(srna, "virtual_pixel_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "virtual_pixel"); + RNA_def_property_enum_items(prop, virtual_pixel_mode_items); + RNA_def_property_ui_text(prop, "Virtual Pixel Mode", "Modify the pixel size for hi-res devices"); + RNA_def_property_update(prop, 0, "rna_userdef_virtual_pixel_update"); + prop = RNA_def_property(srna, "font_path_ui", PROP_STRING, PROP_FILEPATH); RNA_def_property_string_sdna(prop, NULL, "font_path_ui"); RNA_def_property_ui_text(prop, "Interface Font", "Path to interface font"); diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt index 584df9eee75..06e9f8f5b67 100644 --- a/source/blender/modifiers/CMakeLists.txt +++ b/source/blender/modifiers/CMakeLists.txt @@ -132,6 +132,10 @@ if(WITH_MOD_OCEANSIM) add_definitions(-DWITH_OCEANSIM) endif() +if(WITH_BULLET) + add_definitions(-DWITH_BULLET) +endif() + if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() diff --git a/source/blender/modifiers/SConscript b/source/blender/modifiers/SConscript index 88bf33db38e..c15a562abc0 100644 --- a/source/blender/modifiers/SConscript +++ b/source/blender/modifiers/SConscript @@ -63,6 +63,9 @@ if env['WITH_BF_FLUID']: if env['WITH_BF_OCEANSIM']: defs.append('WITH_OCEANSIM') +if env['WITH_BF_BULLET']: + defs.append('WITH_BULLET') + if env['WITH_BF_GAMEENGINE']: incs.append('#/extern/recastnavigation') defs.append('WITH_GAMEENGINE') diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c index 2768d9412d7..40db49afef2 100644 --- a/source/blender/modifiers/intern/MOD_array.c +++ b/source/blender/modifiers/intern/MOD_array.c @@ -404,6 +404,12 @@ static DerivedMesh *arrayModifier_doArray( int *full_doubles_map = NULL; int tot_doubles; + const bool use_merge = amd->flags & MOD_ARR_MERGE; + const bool use_recalc_normals = (dm->dirty & DM_DIRTY_NORMALS) || use_merge; + const bool use_offset_ob = ((amd->offset_type & MOD_ARR_OFF_OBJ) && amd->offset_ob); + /* allow pole vertices to be used by many faces */ + const bool with_follow = use_offset_ob; + int start_cap_nverts = 0, start_cap_nedges = 0, start_cap_npolys = 0, start_cap_nloops = 0; int end_cap_nverts = 0, end_cap_nedges = 0, end_cap_npolys = 0, end_cap_nloops = 0; int result_nverts = 0, result_nedges = 0, result_npolys = 0, result_nloops = 0; @@ -451,7 +457,7 @@ static DerivedMesh *arrayModifier_doArray( offset[3][j] += amd->scale[j] * vertarray_size(src_mvert, chunk_nverts, j); } - if ((amd->offset_type & MOD_ARR_OFF_OBJ) && (amd->offset_ob)) { + if (use_offset_ob) { float obinv[4][4]; float result_mat[4][4]; @@ -514,7 +520,7 @@ static DerivedMesh *arrayModifier_doArray( result = CDDM_from_template(dm, result_nverts, result_nedges, 0, result_nloops, result_npolys); result_dm_verts = CDDM_get_verts(result); - if (amd->flags & MOD_ARR_MERGE) { + if (use_merge) { /* Will need full_doubles_map for handling merge */ full_doubles_map = MEM_mallocN(sizeof(int) * result_nverts, "mod array doubles map"); fill_vn_i(full_doubles_map, result_nverts, -1); @@ -561,6 +567,15 @@ static DerivedMesh *arrayModifier_doArray( /* apply offset to all new verts */ for (i = 0; i < chunk_nverts; i++, mv++, mv_prev++) { mul_m4_v3(current_offset, mv->co); + + /* We have to correct normals too, if we do not tag them as dirty! */ + if (!use_recalc_normals) { + float no[3]; + normal_short_to_float_v3(no, mv->no); + mul_mat3_m4_v3(current_offset, no); + normalize_v3(no); + normal_float_to_short_v3(mv->no, no); + } } /* adjust edge vertex indices */ @@ -583,7 +598,7 @@ static DerivedMesh *arrayModifier_doArray( } /* Handle merge between chunk n and n-1 */ - if ((amd->flags & MOD_ARR_MERGE) && (c >= 1)) { + if (use_merge && (c >= 1)) { if (!offset_has_scale && (c >= 2)) { /* Mapping chunk 3 to chunk 2 is a translation of mapping 2 to 1 * ... that is except if scaling makes the distance grow */ @@ -594,10 +609,15 @@ static DerivedMesh *arrayModifier_doArray( int target = full_doubles_map[prev_chunk_index]; if (target != -1) { target += chunk_nverts; /* translate mapping */ - /* The rule here is to not follow mapping to chunk N-2, which could be too far - * so if target vertex was itself mapped, then this vertex is not mapped */ if (full_doubles_map[target] != -1) { - target = -1; + if (with_follow) { + target = full_doubles_map[target]; + } + else { + /* The rule here is to not follow mapping to chunk N-2, which could be too far + * so if target vertex was itself mapped, then this vertex is not mapped */ + target = -1; + } } } full_doubles_map[this_chunk_index] = target; @@ -612,7 +632,7 @@ static DerivedMesh *arrayModifier_doArray( c * chunk_nverts, chunk_nverts, amd->merge_dist, - false); + with_follow); } } } @@ -622,10 +642,7 @@ static DerivedMesh *arrayModifier_doArray( copy_m4_m4(final_offset, current_offset); - if ((amd->flags & MOD_ARR_MERGE) && - (amd->flags & MOD_ARR_MERGEFINAL) && - (count > 1)) - { + if (use_merge && (amd->flags & MOD_ARR_MERGEFINAL) && (count > 1)) { /* Merge first and last copies */ dm_mvert_map_doubles( full_doubles_map, @@ -635,7 +652,7 @@ static DerivedMesh *arrayModifier_doArray( first_chunk_start, first_chunk_nverts, amd->merge_dist, - false); + with_follow); } /* start capping */ @@ -651,7 +668,7 @@ static DerivedMesh *arrayModifier_doArray( result_npolys - start_cap_npolys - end_cap_npolys, start_cap_nverts, start_cap_nedges, start_cap_nloops, start_cap_npolys); /* Identify doubles with first chunk */ - if (amd->flags & MOD_ARR_MERGE) { + if (use_merge) { dm_mvert_map_doubles( full_doubles_map, result_dm_verts, @@ -676,7 +693,7 @@ static DerivedMesh *arrayModifier_doArray( result_npolys - end_cap_npolys, end_cap_nverts, end_cap_nedges, end_cap_nloops, end_cap_npolys); /* Identify doubles with last chunk */ - if (amd->flags & MOD_ARR_MERGE) { + if (use_merge) { dm_mvert_map_doubles( full_doubles_map, result_dm_verts, @@ -690,19 +707,17 @@ static DerivedMesh *arrayModifier_doArray( } /* done capping */ - /* In case org dm has dirty normals, or we made some merging, mark normals as dirty in new dm! - * TODO: we may need to set other dirty flags as well? - */ - if ((dm->dirty & DM_DIRTY_NORMALS) || full_doubles_map) { - result->dirty |= DM_DIRTY_NORMALS; - } - /* Handle merging */ tot_doubles = 0; - if (full_doubles_map) { + if (use_merge) { for (i = 0; i < result_nverts; i++) { if (full_doubles_map[i] != -1) { - tot_doubles++; + if (i == full_doubles_map[i]) { + full_doubles_map[i] = -1; + } + else { + tot_doubles++; + } } } if (tot_doubles > 0) { @@ -710,6 +725,14 @@ static DerivedMesh *arrayModifier_doArray( } MEM_freeN(full_doubles_map); } + + /* In case org dm has dirty normals, or we made some merging, mark normals as dirty in new dm! + * TODO: we may need to set other dirty flags as well? + */ + if (use_recalc_normals) { + result->dirty |= DM_DIRTY_NORMALS; + } + return result; } diff --git a/source/blender/modifiers/intern/MOD_skin.c b/source/blender/modifiers/intern/MOD_skin.c index 825015fa25c..1e422806d80 100644 --- a/source/blender/modifiers/intern/MOD_skin.c +++ b/source/blender/modifiers/intern/MOD_skin.c @@ -218,6 +218,7 @@ static bool skin_frame_find_contained_faces(const Frame *frame, /* Returns true if hull is successfully built, false otherwise */ static bool build_hull(SkinOutput *so, Frame **frames, int totframe) { +#ifdef WITH_BULLET BMesh *bm = so->bm; BMOperator op; BMIter iter; @@ -326,6 +327,11 @@ static bool build_hull(SkinOutput *so, Frame **frames, int totframe) BM_mesh_delete_hflag_tagged(bm, BM_ELEM_TAG, BM_EDGE | BM_FACE); return true; +#else + (void)so, (void)frames, (void)totframe; + (void)skin_frame_find_contained_faces; + return false; +#endif } /* Returns the average frame side length (frames are rectangular, so diff --git a/source/blender/modifiers/intern/MOD_wireframe.c b/source/blender/modifiers/intern/MOD_wireframe.c index 76986583ef5..7349ca9f9ef 100644 --- a/source/blender/modifiers/intern/MOD_wireframe.c +++ b/source/blender/modifiers/intern/MOD_wireframe.c @@ -60,7 +60,7 @@ static void copyData(ModifierData *md, ModifierData *target) static bool isDisabled(ModifierData *UNUSED(md), int UNUSED(useRenderParams)) { - return 0; + return false; } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) @@ -75,6 +75,11 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) } +static bool dependsOnNormals(ModifierData *UNUSED(md)) +{ + return true; +} + static DerivedMesh *WireframeModifier_do( WireframeModifierData *wmd, Object *ob, DerivedMesh *dm) { DerivedMesh *result; @@ -135,7 +140,7 @@ ModifierTypeInfo modifierType_Wireframe = { /* isDisabled */ isDisabled, /* updateDepgraph */ NULL, /* dependsOnTime */ NULL, - /* dependsOnNormals */ NULL, + /* dependsOnNormals */ dependsOnNormals, /* foreachObjectLink */ NULL, /* foreachIDLink */ NULL, /* foreachTexLink */ NULL, diff --git a/source/blender/nodes/intern/node_exec.c b/source/blender/nodes/intern/node_exec.c index 0893d2022a0..2347564c696 100644 --- a/source/blender/nodes/intern/node_exec.c +++ b/source/blender/nodes/intern/node_exec.c @@ -160,7 +160,6 @@ bNodeTreeExec *ntree_exec_begin(bNodeExecContext *context, bNodeTree *ntree, bNo bNode **nodelist; int totnodes, n; /* XXX texnodes have threading issues with muting, have to disable it there ... */ - bool use_muting = (ntree->type != NTREE_TEXTURE); /* ensure all sock->link pointers and node levels are correct */ ntreeUpdateTree(G.main, ntree); @@ -184,7 +183,7 @@ bNodeTreeExec *ntree_exec_begin(bNodeExecContext *context, bNodeTree *ntree, bNo for (sock = node->inputs.first; sock; sock = sock->next) node_init_input_index(sock, &index); - if (use_muting && (node->flag & NODE_MUTED || node->type == NODE_REROUTE)) { + if (node->flag & NODE_MUTED || node->type == NODE_REROUTE) { for (sock = node->outputs.first; sock; sock = sock->next) node_init_output_index(sock, &index, &node->internal_links); } @@ -306,7 +305,7 @@ bool ntreeExecThreadNodes(bNodeTreeExec *exec, bNodeThreadStack *nts, void *call */ // if (node->typeinfo->compatibility == NODE_NEW_SHADING) // return false; - if (node->typeinfo->execfunc) + if (node->typeinfo->execfunc && !(node->flag & NODE_MUTED)) node->typeinfo->execfunc(callerdata, thread, node, &nodeexec->data, nsin, nsout); } } diff --git a/source/blender/nodes/shader/nodes/node_shader_camera.c b/source/blender/nodes/shader/nodes/node_shader_camera.c index 231af7e7d37..49ebb15d7a4 100644 --- a/source/blender/nodes/shader/nodes/node_shader_camera.c +++ b/source/blender/nodes/shader/nodes/node_shader_camera.c @@ -47,7 +47,7 @@ static void node_shader_exec_camera(void *data, int UNUSED(thread), bNode *UNUSE ShadeInput *shi = ((ShaderCallData *)data)->shi; /* Data we need for shading. */ copy_v3_v3(out[0]->vec, shi->co); /* get view vector */ - out[1]->vec[0] = fabs(shi->co[2]); /* get view z-depth */ + out[1]->vec[0] = fabsf(shi->co[2]); /* get view z-depth */ out[2]->vec[0] = normalize_v3(out[0]->vec); /* get view distance */ } } diff --git a/source/blender/nodes/shader/nodes/node_shader_math.c b/source/blender/nodes/shader/nodes/node_shader_math.c index d5ba8231cce..dc5971909d2 100644 --- a/source/blender/nodes/shader/nodes/node_shader_math.c +++ b/source/blender/nodes/shader/nodes/node_shader_math.c @@ -74,25 +74,25 @@ static void node_shader_exec_math(void *UNUSED(data), int UNUSED(thread), bNode case 4: /* Sine */ { if (in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */ - r = sin(a); + r = sinf(a); else - r = sin(b); + r = sinf(b); break; } case 5: /* Cosine */ { if (in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */ - r = cos(a); + r = cosf(a); else - r = cos(b); + r = cosf(b); break; } case 6: /* Tangent */ { if (in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */ - r = tan(a); + r = tanf(a); else - r = tan(b); + r = tanf(b); break; } case 7: /* Arc-Sine */ @@ -100,14 +100,14 @@ static void node_shader_exec_math(void *UNUSED(data), int UNUSED(thread), bNode if (in[0]->hasinput || !in[1]->hasinput) { /* This one only takes one input, so we've got to choose. */ /* Can't do the impossible... */ if (a <= 1 && a >= -1) - r = asin(a); + r = asinf(a); else r = 0.0; } else { /* Can't do the impossible... */ if (b <= 1 && b >= -1) - r = asin(b); + r = asinf(b); else r = 0.0; } @@ -118,14 +118,14 @@ static void node_shader_exec_math(void *UNUSED(data), int UNUSED(thread), bNode if (in[0]->hasinput || !in[1]->hasinput) { /* This one only takes one input, so we've got to choose. */ /* Can't do the impossible... */ if (a <= 1 && a >= -1) - r = acos(a); + r = acosf(a); else r = 0.0; } else { /* Can't do the impossible... */ if (b <= 1 && b >= -1) - r = acos(b); + r = acosf(b); else r = 0.0; } @@ -218,7 +218,7 @@ static void node_shader_exec_math(void *UNUSED(data), int UNUSED(thread), bNode } case 18: /* Absolute */ { - r = fabs(a); + r = fabsf(a); break; } } diff --git a/source/blender/nodes/shader/nodes/node_shader_vectMath.c b/source/blender/nodes/shader/nodes/node_shader_vectMath.c index b40bf6bc71a..f2ea2faa5a7 100644 --- a/source/blender/nodes/shader/nodes/node_shader_vectMath.c +++ b/source/blender/nodes/shader/nodes/node_shader_vectMath.c @@ -59,14 +59,14 @@ static void node_shader_exec_vect_math(void *UNUSED(data), int UNUSED(thread), b out[0]->vec[1] = vec1[1] + vec2[1]; out[0]->vec[2] = vec1[2] + vec2[2]; - out[1]->vec[0] = (fabs(out[0]->vec[0]) + fabs(out[0]->vec[0]) + fabs(out[0]->vec[0])) / 3; + out[1]->vec[0] = (fabsf(out[0]->vec[0]) + fabsf(out[0]->vec[0]) + fabsf(out[0]->vec[0])) / 3; } else if (node->custom1 == 1) { /* Subtract */ out[0]->vec[0] = vec1[0] - vec2[0]; out[0]->vec[1] = vec1[1] - vec2[1]; out[0]->vec[2] = vec1[2] - vec2[2]; - out[1]->vec[0] = (fabs(out[0]->vec[0]) + fabs(out[0]->vec[0]) + fabs(out[0]->vec[0])) / 3; + out[1]->vec[0] = (fabsf(out[0]->vec[0]) + fabsf(out[0]->vec[0]) + fabsf(out[0]->vec[0])) / 3; } else if (node->custom1 == 2) { /* Average */ out[0]->vec[0] = vec1[0] + vec2[0]; diff --git a/source/blender/nodes/texture/node_texture_tree.c b/source/blender/nodes/texture/node_texture_tree.c index 02f15705ad1..1b790f87faf 100644 --- a/source/blender/nodes/texture/node_texture_tree.c +++ b/source/blender/nodes/texture/node_texture_tree.c @@ -140,7 +140,7 @@ static void foreach_nodeclass(Scene *UNUSED(scene), void *calldata, bNodeClassCa /* XXX muting disabled in previews because of threading issues with the main execution * it works here, but disabled for consistency */ -#if 0 +#if 1 static void localize(bNodeTree *localtree, bNodeTree *UNUSED(ntree)) { bNode *node, *node_next; diff --git a/source/blender/nodes/texture/node_texture_util.c b/source/blender/nodes/texture/node_texture_util.c index e01b7ec49f1..42c684b8247 100644 --- a/source/blender/nodes/texture/node_texture_util.c +++ b/source/blender/nodes/texture/node_texture_util.c @@ -140,11 +140,19 @@ void tex_do_preview(bNodePreview *preview, const float coord[2], const float col void tex_output(bNode *node, bNodeExecData *execdata, bNodeStack **in, bNodeStack *out, TexFn texfn, TexCallData *cdata) { TexDelegate *dg; - if (!out->data) - /* Freed in tex_end_exec (node.c) */ - dg = out->data = MEM_mallocN(sizeof(TexDelegate), "tex delegate"); - else - dg = out->data; + + if (node->flag & NODE_MUTED) { + /* do not add a delegate if the node is muted */ + return; + } + else { + if (!out->data) + /* Freed in tex_end_exec (node.c) */ + dg = out->data = MEM_mallocN(sizeof(TexDelegate), "tex delegate"); + else + dg = out->data; + } + dg->cdata = cdata; dg->fn = texfn; diff --git a/source/blender/nodes/texture/nodes/node_texture_math.c b/source/blender/nodes/texture/nodes/node_texture_math.c index 9bd2532b4b8..94e778e10fb 100644 --- a/source/blender/nodes/texture/nodes/node_texture_math.c +++ b/source/blender/nodes/texture/nodes/node_texture_math.c @@ -72,24 +72,24 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor } case 4: /* Sine */ { - *out = sin(in0); + *out = sinf(in0); break; } case 5: /* Cosine */ { - *out = cos(in0); + *out = cosf(in0); break; } case 6: /* Tangent */ { - *out = tan(in0); + *out = tanf(in0); break; } case 7: /* Arc-Sine */ { /* Can't do the impossible... */ if (in0 <= 1 && in0 >= -1) - *out = asin(in0); + *out = asinf(in0); else *out = 0.0; break; @@ -98,7 +98,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor { /* Can't do the impossible... */ if (in0 <= 1 && in0 >= -1) - *out = acos(in0); + *out = acosf(in0); else *out = 0.0; break; @@ -185,7 +185,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor case 18: /* Absolute */ { - *out = fabs(in0); + *out = fabsf(in0); break; } diff --git a/source/blender/python/bmesh/bmesh_py_ops_call.c b/source/blender/python/bmesh/bmesh_py_ops_call.c index 9c9b69186ab..2c07df98973 100644 --- a/source/blender/python/bmesh/bmesh_py_ops_call.c +++ b/source/blender/python/bmesh/bmesh_py_ops_call.c @@ -507,7 +507,7 @@ static int bpy_slot_from_py(BMesh *bm, BMOperator *bmop, BMOpSlot *slot, PyObjec return -1; } } - /* fall-through */ + break; } default: /* TODO --- many others */ diff --git a/source/blender/python/intern/bpy_app_translations.c b/source/blender/python/intern/bpy_app_translations.c index 109e5606037..0114e8e65e4 100644 --- a/source/blender/python/intern/bpy_app_translations.c +++ b/source/blender/python/intern/bpy_app_translations.c @@ -86,16 +86,15 @@ static unsigned int _ghashutil_keyhash(const void *ptr) return hash ^ BLI_ghashutil_strhash(key->msgid); } -static int _ghashutil_keycmp(const void *a, const void *b) +static bool _ghashutil_keycmp(const void *a, const void *b) { const GHashKey *A = a; const GHashKey *B = b; /* Note: comparing msgid first, most of the time it will be enough! */ - int cmp = BLI_ghashutil_strcmp(A->msgid, B->msgid); - if (cmp == 0) + if (BLI_ghashutil_strcmp(A->msgid, B->msgid) == false) return BLI_ghashutil_strcmp(A->msgctxt, B->msgctxt); - return cmp; + return true; /* true means they are not equal! */ } static void _ghashutil_keyfree(void *ptr) diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index ddfbfecc46e..d46c95a25b8 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -420,7 +420,7 @@ static void python_script_error_jump_text(struct Text *text) typedef struct { PyObject_HEAD PyObject *md_dict; - /* ommit other values, we only want the dict. */ + /* omit other values, we only want the dict. */ } PyModuleObject; #endif diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c index 75fe05ae2f5..ae3476f5802 100644 --- a/source/blender/python/mathutils/mathutils_Quaternion.c +++ b/source/blender/python/mathutils/mathutils_Quaternion.c @@ -947,7 +947,7 @@ static PyObject *Quaternion_magnitude_get(QuaternionObject *self, void *UNUSED(c if (BaseMath_ReadCallback(self) == -1) return NULL; - return PyFloat_FromDouble(sqrt(dot_qtqt(self->quat, self->quat))); + return PyFloat_FromDouble(sqrtf(dot_qtqt(self->quat, self->quat))); } PyDoc_STRVAR(Quaternion_angle_doc, diff --git a/source/blender/python/rna_dump.py b/source/blender/python/rna_dump.py index 15cc60d997e..7259ceb67a0 100644 --- a/source/blender/python/rna_dump.py +++ b/source/blender/python/rna_dump.py @@ -1,22 +1,22 @@ - # ***** 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): Campbell Barton - # - # #**** END GPL LICENSE BLOCK #**** +# ##### 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): Campbell Barton +# +# ##### END GPL LICENSE BLOCK ##### # <pep8 compliant> diff --git a/source/blender/render/CMakeLists.txt b/source/blender/render/CMakeLists.txt index 8e326e770fc..e516c954737 100644 --- a/source/blender/render/CMakeLists.txt +++ b/source/blender/render/CMakeLists.txt @@ -162,6 +162,10 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() +if(WITH_CYCLES AND WITH_CYCLES_DEBUG) + add_definitions(-DWITH_CYCLES_DEBUG) +endif() + if(APPLE) # SSE math is enabled by default on x86_64 if(CMAKE_OSX_ARCHITECTURES MATCHES "i386") diff --git a/source/blender/render/SConscript b/source/blender/render/SConscript index 297e4fcecd4..7f459444a39 100644 --- a/source/blender/render/SConscript +++ b/source/blender/render/SConscript @@ -103,6 +103,9 @@ if env['WITH_BF_GAMEENGINE']: if env['WITH_BF_INTERNATIONAL']: defs.append('WITH_INTERNATIONAL') +if env['WITH_BF_CYCLES'] and env['WITH_BF_CYCLES_DEBUG']: + defs.append('WITH_CYCLES_DEBUG') + if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): incs += ' ' + env['BF_PTHREADS_INC'] diff --git a/source/blender/render/extern/include/RE_engine.h b/source/blender/render/extern/include/RE_engine.h index 24f8cbee401..4b0473f7483 100644 --- a/source/blender/render/extern/include/RE_engine.h +++ b/source/blender/render/extern/include/RE_engine.h @@ -60,6 +60,7 @@ struct BakePixel; #define RE_USE_SHADING_NODES 16 #define RE_USE_EXCLUDE_LAYERS 32 #define RE_USE_SAVE_BUFFERS 64 +#define RE_USE_TEXTURE_PREVIEW 128 /* RenderEngine.flag */ #define RE_ENGINE_ANIMATION 1 diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h index 3b54de4c943..61795c2c173 100644 --- a/source/blender/render/extern/include/RE_pipeline.h +++ b/source/blender/render/extern/include/RE_pipeline.h @@ -72,8 +72,13 @@ typedef struct RenderPass { char chan_id[8]; /* amount defined in openexr_multi.h */ float *rect; int rectx, recty; + int debug_type; } RenderPass; +enum { + RENDER_PASS_DEBUG_BVH_TRAVERSAL_STEPS = 0, +}; + /* a renderlayer is a full image, but with all passes and samples */ /* size of the rects is defined in RenderResult */ /* after render, the Combined pass is in rectf, for renderlayers read from files it is a real pass */ diff --git a/source/blender/render/intern/raytrace/rayobject_octree.cpp b/source/blender/render/intern/raytrace/rayobject_octree.cpp index 24804b8c0ad..6cbb0761358 100644 --- a/source/blender/render/intern/raytrace/rayobject_octree.cpp +++ b/source/blender/render/intern/raytrace/rayobject_octree.cpp @@ -657,7 +657,7 @@ static void RE_rayobject_octree_done(RayObject *tree) oc->ocfacy = (oc->ocres - 0.1f) / t01; oc->ocfacz = (oc->ocres - 0.1f) / t02; - oc->ocsize = sqrt(t00 * t00 + t01 * t01 + t02 * t02); /* global, max size octree */ + oc->ocsize = sqrtf(t00 * t00 + t01 * t01 + t02 * t02); /* global, max size octree */ for (c = 0; c < oc->ro_nodes_used; c++) { octree_fill_rayface(oc, oc->ro_nodes[c]); diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index e6f054583b1..69dd9607c3b 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -762,7 +762,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par w= vec[2]*re->winmat[2][3] + re->winmat[3][3]; dx= re->winx*cross[0]*re->winmat[0][0]; dy= re->winy*cross[1]*re->winmat[1][1]; - w= sqrt(dx*dx + dy*dy)/w; + w = sqrtf(dx * dx + dy * dy) / w; if (w!=0.0f) { float fac; @@ -927,7 +927,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par w= vec[2]*re->winmat[2][3] + re->winmat[3][3]; dx= re->winx*dvec[0]*re->winmat[0][0]/w; dy= re->winy*dvec[1]*re->winmat[1][1]/w; - w= sqrt(dx*dx + dy*dy); + w = sqrtf(dx * dx + dy * dy); if (dot_v3v3(anor, nor)<sd->adapt_angle && w>sd->adapt_pix) { vlr= RE_findOrAddVlak(obr, obr->totvlak++); vlr->flag= flag; @@ -3796,8 +3796,8 @@ static GroupObject *add_render_lamp(Render *re, Object *ob) normalize_v3(lar->imat[1]); normalize_v3(lar->imat[2]); - xn= saacos(lar->spotsi); - xn= sin(xn)/cos(xn); + xn = saacos(lar->spotsi); + xn = sinf(xn) / cosf(xn); lar->spottexfac= 1.0f/(xn); if (lar->mode & LA_ONLYSHADOW) { @@ -3820,7 +3820,7 @@ static GroupObject *add_render_lamp(Render *re, Object *ob) /* z factor, for a normalized volume */ angle= saacos(lar->spotsi); xn= lar->spotsi; - yn= sin(angle); + yn = sinf(angle); lar->sh_zfac= yn/xn; /* pre-scale */ lar->sh_invcampos[2]*= lar->sh_zfac; @@ -5438,7 +5438,7 @@ static float *calculate_strandsurface_speedvectors(Render *re, ObjectInstanceRen { if (mesh->co && mesh->prevco && mesh->nextco) { float winsq= (float)re->winx*(float)re->winy; /* int's can wrap on large images */ - float winroot= sqrt(winsq); + float winroot= sqrtf(winsq); float (*winspeed)[4]; float ho[4], prevho[4], nextho[4], winmat[4][4], vec[2]; int a; @@ -5477,7 +5477,7 @@ static void calculate_speedvectors(Render *re, ObjectInstanceRen *obi, float *ve StrandSurface *mesh= NULL; float *speed, (*winspeed)[4]=NULL, ho[4], winmat[4][4]; float *co1, *co2, *co3, *co4, w[4]; - float winsq= (float)re->winx*(float)re->winy, winroot= sqrt(winsq); /* int's can wrap on large images */ + float winsq = (float)re->winx * (float)re->winy, winroot = sqrtf(winsq); /* int's can wrap on large images */ int a, *face, *index; if (obi->flag & R_TRANSFORMED) @@ -5544,7 +5544,7 @@ static int load_fluidsimspeedvectors(Render *re, ObjectInstanceRen *obi, float * VertRen *ver= NULL; float *speed, div, zco[2], avgvel[4] = {0.0, 0.0, 0.0, 0.0}; float zmulx= re->winx/2, zmuly= re->winy/2, len; - float winsq= (float)re->winx*(float)re->winy, winroot= sqrt(winsq); /* int's can wrap on large images */ + float winsq = (float)re->winx * (float)re->winy, winroot= sqrtf(winsq); /* int's can wrap on large images */ int a, j; float hoco[4], ho[4], fsvec[4], camco[4]; float mat[4][4], winmat[4][4]; diff --git a/source/blender/render/intern/source/initrender.c b/source/blender/render/intern/source/initrender.c index 5fd4747f19b..353ba5d5caa 100644 --- a/source/blender/render/intern/source/initrender.c +++ b/source/blender/render/intern/source/initrender.c @@ -190,7 +190,7 @@ static float calc_weight(Render *re, float *weight, int i, int j) for (a = 0; a < re->osa; a++) { x = re->jit[a][0] + i; y = re->jit[a][1] + j; - dist = sqrt(x * x + y * y); + dist = sqrtf(x * x + y * y); weight[a] = 0.0; diff --git a/source/blender/render/intern/source/multires_bake.c b/source/blender/render/intern/source/multires_bake.c index 4ac1593d1bb..6ba85ea5329 100644 --- a/source/blender/render/intern/source/multires_bake.c +++ b/source/blender/render/intern/source/multires_bake.c @@ -42,6 +42,7 @@ #include "BLI_threads.h" #include "BKE_ccg.h" +#include "BKE_depsgraph.h" #include "BKE_global.h" #include "BKE_image.h" #include "BKE_multires.h" @@ -1154,10 +1155,10 @@ static void apply_ao_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm, void /* this gives results identical to the so-called cosine * weighted distribution relative to the north pole. */ - float SiPhi = sqrt(SiSqPhi); + float SiPhi = sqrtf(SiSqPhi); float CoPhi = SiSqPhi < 1.0f ? sqrtf(1.0f - SiSqPhi) : 0; - float CoThe = cos(Theta); - float SiThe = sin(Theta); + float CoThe = cosf(Theta); + float SiThe = sinf(Theta); const float dx = CoThe * CoPhi; const float dy = SiThe * CoPhi; @@ -1297,6 +1298,7 @@ static void finish_images(MultiresBakeRender *bkr, MultiresBakeResult *result) } BKE_image_release_ibuf(ima, ibuf, NULL); + DAG_id_tag_update(&ima->id, 0); } } diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 32bd67cb1f2..7b43c77537f 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -699,25 +699,27 @@ static void render_result_rescale(Render *re) RR_USE_MEM, RR_ALL_LAYERS); - dst_rectf = re->result->rectf; - if (dst_rectf == NULL) { - RenderLayer *rl; - rl = render_get_active_layer(re, re->result); - if (rl != NULL) { - dst_rectf = rl->rectf; + if (re->result != NULL) { + dst_rectf = re->result->rectf; + if (dst_rectf == NULL) { + RenderLayer *rl; + rl = render_get_active_layer(re, re->result); + if (rl != NULL) { + dst_rectf = rl->rectf; + } } - } - scale_x = (float) result->rectx / re->result->rectx; - scale_y = (float) result->recty / re->result->recty; - for (x = 0; x < re->result->rectx; ++x) { - for (y = 0; y < re->result->recty; ++y) { - int src_x = x * scale_x, - src_y = y * scale_y; - int dst_index = y * re->result->rectx + x, - src_index = src_y * result->rectx + src_x; - copy_v4_v4(dst_rectf + dst_index * 4, - src_rectf + src_index * 4); + scale_x = (float) result->rectx / re->result->rectx; + scale_y = (float) result->recty / re->result->recty; + for (x = 0; x < re->result->rectx; ++x) { + for (y = 0; y < re->result->recty; ++y) { + int src_x = x * scale_x, + src_y = y * scale_y; + int dst_index = y * re->result->rectx + x, + src_index = src_y * result->rectx + src_x; + copy_v4_v4(dst_rectf + dst_index * 4, + src_rectf + src_index * 4); + } } } } @@ -1013,8 +1015,8 @@ static bool find_next_pano_slice(Render *re, int *slice, int *minx, rctf *viewpl /* rotate database according to part coordinates */ project_renderdata(re, projectverto, 1, -R.panodxp * phi, 1); - R.panosi = sin(R.panodxp * phi); - R.panoco = cos(R.panodxp * phi); + R.panosi = sinf(R.panodxp * phi); + R.panoco = cosf(R.panodxp * phi); } (*slice)++; @@ -1638,6 +1640,10 @@ static void do_render_fields_blur_3d(Render *re) if (re->r.mode & R_BORDER) { if ((re->r.mode & R_CROP) == 0) { RenderResult *rres; + + /* backup */ + const rcti orig_disprect = re->disprect; + const int orig_rectx = re->rectx, orig_recty = re->recty; BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE); @@ -1660,6 +1666,11 @@ static void do_render_fields_blur_3d(Render *re) re->display_init(re->dih, re->result); re->display_update(re->duh, re->result, NULL); + + /* restore the disprect from border */ + re->disprect = orig_disprect; + re->rectx = orig_rectx; + re->recty = orig_recty; } else { /* set offset (again) for use in compositor, disprect was manipulated. */ @@ -2651,7 +2662,16 @@ bool RE_is_rendering_allowed(Scene *scene, Object *camera_override, ReportList * } #endif } - + +#ifdef WITH_FREESTYLE + if (scene->r.mode & R_EDGE_FRS) { + if (scene->r.mode & R_FIELDS) { + BKE_report(reports, RPT_ERROR, "Fields not supported in Freestyle"); + return false; + } + } +#endif + /* layer flag tests */ if (!render_scene_has_layers_to_render(scene)) { BKE_report(reports, RPT_ERROR, "All render layers are disabled"); diff --git a/source/blender/render/intern/source/pixelshading.c b/source/blender/render/intern/source/pixelshading.c index 09a6a6374be..014df802a78 100644 --- a/source/blender/render/intern/source/pixelshading.c +++ b/source/blender/render/intern/source/pixelshading.c @@ -160,7 +160,7 @@ static void render_lighting_halo(HaloRen *har, float col_r[3]) x = max_ff(fabsf(lvrot[0]/lvrot[2]), fabsf(lvrot[1]/lvrot[2])); /* 1.0/(sqrt(1+x*x)) is equivalent to cos(atan(x)) */ - inpr= 1.0/(sqrt(1.0f+x*x)); + inpr = 1.0 / (sqrtf(1.0f + x * x)); } else inpr= 0.0; } @@ -206,7 +206,7 @@ static void render_lighting_halo(HaloRen *har, float col_r[3]) /* dot product and reflectivity*/ - inp = 1.0 - fabs(dot_v3v3(vn, lv)); + inp = 1.0 - fabsf(dot_v3v3(vn, lv)); /* inp= cos(0.5*M_PI-acos(inp)); */ @@ -329,7 +329,7 @@ int shadeHaloFloat(HaloRen *har, float col[4], int zz, } } - radist= sqrt(dist); + radist = sqrtf(dist); /* watch it: not used nicely: flarec is set at zero in pixstruct */ if (flarec) har->pixels+= (int)(har->rad-radist); @@ -366,17 +366,15 @@ int shadeHaloFloat(HaloRen *har, float col[4], int zz, else dist= dist/har->radsq; if (har->type & HA_FLARECIRC) { - - dist= 0.5+fabs(dist-0.5f); - + dist = 0.5 + fabsf(dist - 0.5f); } if (har->hard>=30) { - dist= sqrt(dist); + dist = sqrtf(dist); if (har->hard>=40) { - dist= sinf(dist*(float)M_PI_2); + dist = sinf(dist*(float)M_PI_2); if (har->hard>=50) { - dist= sqrt(dist); + dist = sqrtf(dist); } } } @@ -399,7 +397,7 @@ int shadeHaloFloat(HaloRen *har, float col[4], int zz, rc= hashvectf + (ofs % 768); - fac= fabs( (xn)*rc[0]+(yn)*rc[1]); + fac = fabsf((xn) * rc[0] + (yn) * rc[1]); if (fac< 1.0f ) linef+= (1.0f-fac); @@ -411,15 +409,15 @@ int shadeHaloFloat(HaloRen *har, float col[4], int zz, if (har->starpoints) { float ster, angle; /* rotation */ - angle= atan2(yn, xn); - angle*= (1.0f+0.25f*har->starpoints); + angle = atan2f(yn, xn); + angle *= (1.0f+0.25f*har->starpoints); co= cosf(angle); si= sinf(angle); angle= (co*xn+si*yn)*(co*yn-si*xn); - ster= fabs(angle); + ster = fabsf(angle); if (ster>1.0f) { ster= (har->rad)/(ster); diff --git a/source/blender/render/intern/source/pointdensity.c b/source/blender/render/intern/source/pointdensity.c index 799f7fa2f2e..ac2e85a33b3 100644 --- a/source/blender/render/intern/source/pointdensity.c +++ b/source/blender/render/intern/source/pointdensity.c @@ -384,7 +384,7 @@ static void accum_density(void *userdata, int index, float squared_dist) else if (pdr->falloff_type == TEX_PD_FALLOFF_CONSTANT) density = pdr->squared_radius; else if (pdr->falloff_type == TEX_PD_FALLOFF_ROOT) - density = sqrt(dist); + density = sqrtf(dist); else if (pdr->falloff_type == TEX_PD_FALLOFF_PARTICLE_AGE) { if (pdr->point_data_used & POINT_DATA_LIFE) density = dist*MIN2(pdr->point_data[pdr->offset + index], 1.0f); diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c index 7e56d93f23b..ff1f502cc1a 100644 --- a/source/blender/render/intern/source/rayshade.c +++ b/source/blender/render/intern/source/rayshade.c @@ -651,7 +651,7 @@ static float shade_by_transmission(Isect *is, ShadeInput *shi, ShadeResult *shr) const float dx= shi->co[0] - is->start[0]; const float dy= shi->co[1] - is->start[1]; const float dz= shi->co[2] - is->start[2]; - d= sqrt(dx*dx+dy*dy+dz*dz); + d = sqrtf(dx * dx + dy * dy + dz * dz); if (d > shi->mat->tx_limit) d= shi->mat->tx_limit; @@ -1117,7 +1117,7 @@ static void QMC_samplePhong(float vec[3], QMCSampler *qsa, int thread, int num, phi = s[0]*2*M_PI; pz = pow(s[1], blur); - sqr = sqrt(1.0f-pz*pz); + sqr = sqrtf(1.0f - pz * pz); vec[0] = (float)(cosf(phi)*sqr); vec[1] = (float)(sinf(phi)*sqr); @@ -1281,7 +1281,7 @@ static float get_avg_speed(ShadeInput *shi) post_x = (shi->winspeed[2] == PASS_VECTOR_MAX)?0.0f:shi->winspeed[2]; post_y = (shi->winspeed[3] == PASS_VECTOR_MAX)?0.0f:shi->winspeed[3]; - speedavg = (sqrt(pre_x*pre_x + pre_y*pre_y) + sqrt(post_x*post_x + post_y*post_y)) / 2.0; + speedavg = (sqrtf(pre_x * pre_x + pre_y * pre_y) + sqrtf(post_x * post_x + post_y * post_y)) / 2.0; return speedavg; } @@ -1786,10 +1786,10 @@ static float *sphere_sampler(int type, int resol, int thread, int xs, int ys, in sphere= threadsafe_table_sphere(0, thread, xs, ys, tot); /* random rotation */ - ang= BLI_thread_frand(thread); - sinfi= sin(ang); cosfi= cos(ang); - ang= BLI_thread_frand(thread); - sint= sin(ang); cost= cos(ang); + ang = BLI_thread_frand(thread); + sinfi = sinf(ang); cosfi = cosf(ang); + ang = BLI_thread_frand(thread); + sint = sinf(ang); cost = cosf(ang); vec= R.wrld.aosphere; vec1= sphere; @@ -2371,9 +2371,9 @@ static void ray_shadow_jitter(ShadeInput *shi, LampRen *lar, const float lampco[ mul_m3_v3(lar->mat, vec); /* set start and vec */ - isec->dir[0] = vec[0]+lampco[0]-isec->start[0]; - isec->dir[1] = vec[1]+lampco[1]-isec->start[1]; - isec->dir[2] = vec[2]+lampco[2]-isec->start[2]; + isec->dir[0] = vec[0]+lampco[0]-shi->co[0]; + isec->dir[1] = vec[1]+lampco[1]-shi->co[1]; + isec->dir[2] = vec[2]+lampco[2]-shi->co[2]; RE_instance_rotate_ray_dir(shi->obi, isec); @@ -2406,9 +2406,9 @@ static void ray_shadow_jitter(ShadeInput *shi, LampRen *lar, const float lampco[ else { /* sqrt makes nice umbra effect */ if (lar->ray_samp_type & LA_SAMP_UMBRA) - shadfac[3]= sqrt(1.0f-fac/div); + shadfac[3] = sqrtf(1.0f - fac / div); else - shadfac[3]= 1.0f-fac/div; + shadfac[3] = 1.0f - fac / div; } } /* extern call from shade_lamp_loop */ diff --git a/source/blender/render/intern/source/render_result.c b/source/blender/render/intern/source/render_result.c index d8410fbe257..24797521435 100644 --- a/source/blender/render/intern/source/render_result.c +++ b/source/blender/render/intern/source/render_result.c @@ -48,6 +48,9 @@ #include "BKE_global.h" #include "BKE_main.h" #include "BKE_report.h" +#ifdef WITH_CYCLES_DEBUG +# include "BKE_scene.h" +#endif #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" @@ -402,7 +405,7 @@ static int passtype_from_name(const char *str) /********************************** New **************************************/ -static void render_layer_add_pass(RenderResult *rr, RenderLayer *rl, int channels, int passtype) +static RenderPass *render_layer_add_pass(RenderResult *rr, RenderLayer *rl, int channels, int passtype) { const char *typestr = get_pass_name(passtype, 0); RenderPass *rpass = MEM_callocN(sizeof(RenderPass), typestr); @@ -438,8 +441,34 @@ static void render_layer_add_pass(RenderResult *rr, RenderLayer *rl, int channel rect[x] = 10e10; } } + return rpass; } +#ifdef WITH_CYCLES_DEBUG +static const char *debug_pass_type_name_get(int debug_type) +{ + switch (debug_type) { + case RENDER_PASS_DEBUG_BVH_TRAVERSAL_STEPS: + return "BVH Traversal Steps"; + } + return "Unknown"; +} + +static RenderPass *render_layer_add_debug_pass(RenderResult *rr, + RenderLayer *rl, + int channels, + int pass_type, + int debug_type) +{ + RenderPass *rpass = render_layer_add_pass(rr, rl, channels, pass_type); + rpass->debug_type = debug_type; + BLI_strncpy(rpass->name, + debug_pass_type_name_get(debug_type), + sizeof(rpass->name)); + return rpass; +} +#endif + /* called by main render as well for parts */ /* will read info from Render *re to define layers */ /* called in threads */ @@ -578,6 +607,13 @@ RenderResult *render_result_new(Render *re, rcti *partrct, int crop, int savebuf render_layer_add_pass(rr, rl, 3, SCE_PASS_SUBSURFACE_INDIRECT); if (srl->passflag & SCE_PASS_SUBSURFACE_COLOR) render_layer_add_pass(rr, rl, 3, SCE_PASS_SUBSURFACE_COLOR); + +#ifdef WITH_CYCLES_DEBUG + if(BKE_scene_use_new_shading_nodes(re->scene)) { + render_layer_add_debug_pass(rr, rl, 1, SCE_PASS_DEBUG, + RENDER_PASS_DEBUG_BVH_TRAVERSAL_STEPS); + } +#endif } /* sss, previewrender and envmap don't do layers, so we make a default one */ if (BLI_listbase_is_empty(&rr->layers) && !(layername && layername[0])) { diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c index dd14c2495e8..0e61c3e796a 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -212,10 +212,10 @@ static int blend(Tex *tex, const float texvec[3], TexResult *texres) texres->tin= (2.0f+x+y)/4.0f; } else if (tex->stype==TEX_RAD) { /* radial */ - texres->tin= (atan2(y, x) / (2*M_PI) + 0.5); + texres->tin = (atan2f(y, x) / (2 * M_PI) + 0.5f); } else { /* sphere TEX_SPHERE */ - texres->tin= 1.0-sqrt(x*x+ y*y+texvec[2]*texvec[2]); + texres->tin = 1.0 - sqrtf(x * x + y * y + texvec[2] * texvec[2]); if (texres->tin<0.0f) texres->tin= 0.0f; if (tex->stype==TEX_HALO) texres->tin*= texres->tin; /* halo */ } @@ -266,8 +266,8 @@ static int clouds(Tex *tex, const float texvec[3], TexResult *texres) /* creates a sine wave */ static float tex_sin(float a) { - a = 0.5 + 0.5*sin(a); - + a = 0.5 + 0.5 * sinf(a); + return a; } @@ -366,10 +366,10 @@ static float marble_int(Tex *tex, float x, float y, float z) if (mt>=TEX_SOFT) { /* TEX_SOFT always true */ mi = waveform[wf](mi); if (mt==TEX_SHARP) { - mi = sqrt(mi); + mi = sqrtf(mi); } else if (mt==TEX_SHARPER) { - mi = sqrt(sqrt(mi)); + mi = sqrtf(sqrtf(mi)); } } @@ -408,41 +408,41 @@ static int magic(Tex *tex, const float texvec[3], TexResult *texres) n= tex->noisedepth; turb= tex->turbul/5.0f; - x= sin( ( texvec[0]+texvec[1]+texvec[2])*5.0f ); - y= cos( (-texvec[0]+texvec[1]-texvec[2])*5.0f ); - z= -cos( (-texvec[0]-texvec[1]+texvec[2])*5.0f ); + x = sinf(( texvec[0] + texvec[1] + texvec[2]) * 5.0f); + y = cosf((-texvec[0] + texvec[1] - texvec[2]) * 5.0f); + z = -cosf((-texvec[0] - texvec[1] + texvec[2]) * 5.0f); if (n>0) { x*= turb; y*= turb; z*= turb; - y= -cos(x-y+z); + y= -cosf(x-y+z); y*= turb; if (n>1) { - x= cos(x-y-z); + x= cosf(x-y-z); x*= turb; if (n>2) { - z= sin(-x-y-z); + z= sinf(-x-y-z); z*= turb; if (n>3) { - x= -cos(-x+y-z); + x= -cosf(-x+y-z); x*= turb; if (n>4) { - y= -sin(-x+y+z); + y= -sinf(-x+y+z); y*= turb; if (n>5) { - y= -cos(-x+y+z); + y= -cosf(-x+y+z); y*= turb; if (n>6) { - x= cos(x+y+z); + x= cosf(x+y+z); x*= turb; if (n>7) { - z= sin(x+y-z); + z= sinf(x+y-z); z*= turb; if (n>8) { - x= -cos(-x-y+z); + x= -cosf(-x-y+z); x*= turb; if (n>9) { - y= -sin(x-y+z); + y= -sinf(x-y+z); y*= turb; } } @@ -2348,8 +2348,8 @@ void do_material_tex(ShadeInput *shi, Render *re) copy_v3_v3(texres.nor, &texres.tr); } else { - float co_nor= 0.5*cos(texres.tin-0.5f); - float si= 0.5*sin(texres.tin-0.5f); + float co_nor= 0.5f * cosf(texres.tin - 0.5f); + float si = 0.5f * sinf(texres.tin - 0.5f); float f1, f2; f1= shi->vn[0]; @@ -3396,8 +3396,11 @@ void do_lamp_tex(LampRen *la, const float lavec[3], ShadeInput *shi, float col_r col[0]= texres.tr*la->energy; col[1]= texres.tg*la->energy; col[2]= texres.tb*la->energy; - - texture_rgb_blend(col_r, col, col_r, texres.tin, mtex->colfac, mtex->blendtype); + + if (effect & LA_SHAD_TEX) + texture_rgb_blend(col_r, col, col_r, texres.tin, mtex->shadowfac, mtex->blendtype); + else + texture_rgb_blend(col_r, col, col_r, texres.tin, mtex->colfac, mtex->blendtype); } } } diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c index 27bc449dce3..a67140c6334 100644 --- a/source/blender/render/intern/source/rendercore.c +++ b/source/blender/render/intern/source/rendercore.c @@ -1906,9 +1906,9 @@ static void renderflare(RenderResult *rr, float *rectf, HaloRen *har) fla.hard= 20.0f + fabsf(70.0f*rc[7]); fla.tex= 0; - type= (int)(fabs(3.9f*rc[6])); + type= (int)(fabsf(3.9f*rc[6])); - fla.rad= ma->subsize*sqrtf(fabs(2.0f*har->rad*rc[4])); + fla.rad = ma->subsize * sqrtf(fabsf(2.0f * har->rad * rc[4])); if (type==3) { fla.rad*= 3.0f; diff --git a/source/blender/render/intern/source/renderdatabase.c b/source/blender/render/intern/source/renderdatabase.c index 6a3787289d8..46c504aaabf 100644 --- a/source/blender/render/intern/source/renderdatabase.c +++ b/source/blender/render/intern/source/renderdatabase.c @@ -992,10 +992,10 @@ HaloRen *RE_inithalo(Render *re, ObjectRen *obr, Material *ma, xn= har->xs - 0.5f*re->winx*(hoco1[0]/hoco1[3]); yn= har->ys - 0.5f*re->winy*(hoco1[1]/hoco1[3]); if (xn==0.0f || (xn==0.0f && yn==0.0f)) zn= 0.0f; - else zn= atan2(yn, xn); + else zn = atan2f(yn, xn); - har->sin= sin(zn); - har->cos= cos(zn); + har->sin = sinf(zn); + har->cos = cosf(zn); zn= len_v3v3(vec1, vec); har->hasize= vectsize*zn + (1.0f-vectsize)*hasize; @@ -1112,10 +1112,10 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater xn= har->xs - 0.5f*re->winx*(hoco1[0]/hoco1[3]); yn= har->ys - 0.5f*re->winy*(hoco1[1]/hoco1[3]); if (xn==0.0f || (xn==0.0f && yn==0.0f)) zn= 0.0; - else zn= atan2(yn, xn); + else zn = atan2f(yn, xn); - har->sin= sin(zn); - har->cos= cos(zn); + har->sin = sinf(zn); + har->cos = cosf(zn); zn= len_v3v3(vec1, vec)*0.5f; har->hasize= vectsize*zn + (1.0f-vectsize)*hasize; @@ -1284,8 +1284,8 @@ void project_renderdata(Render *re, if (do_pano) { float panophi= xoffs; - re->panosi= sin(panophi); - re->panoco= cos(panophi); + re->panosi = sinf(panophi); + re->panoco = cosf(panophi); } for (obr=re->objecttable.first; obr; obr=obr->next) { diff --git a/source/blender/render/intern/source/shadbuf.c b/source/blender/render/intern/source/shadbuf.c index aa420d7e7c8..9d83ff1d7e8 100644 --- a/source/blender/render/intern/source/shadbuf.c +++ b/source/blender/render/intern/source/shadbuf.c @@ -536,7 +536,7 @@ static void compress_shadowbuf(ShadBuf *shb, int *rectz, int square) if (x< a) minx= x+15-a; else minx= x-a; - dist= sqrt( (float)(minx*minx+miny*miny) ); + dist = sqrtf((float)(minx * minx + miny * miny)); if (square==0 && dist>(float)(a+12)) { /* 12, tested with a onlyshadow lamp */ a= 256; verg= 0; /* 0x80000000; */ /* 0x7FFFFFFF; */ @@ -1685,7 +1685,7 @@ static int point_behind_strand(const float p[3], BSPFace *face) if (face->len==0.0f) { rc[0]= p[0]-face->vec1[0]; rc[1]= p[1]-face->vec1[1]; - dist= (float)(sqrt(rc[0]*rc[0]+ rc[1]*rc[1])); + dist = len_v2(rc); if (dist < face->radline) return 1; @@ -1699,10 +1699,10 @@ static int point_behind_strand(const float p[3], BSPFace *face) pt[0]= lambda*face->rc[0]+face->vec1[0]; pt[1]= lambda*face->rc[1]+face->vec1[1]; - + rc[0]= pt[0]-p[0]; rc[1]= pt[1]-p[1]; - dist= sqrtf(rc[0]*rc[0]+ rc[1]*rc[1]); + dist = len_v2(rc); if (dist < face->radline) { float zval= face->vec1[2] + lambda*face->rc[2]; diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index 427d0eeed11..f909c585561 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -144,7 +144,7 @@ float mistfactor(float zcor, float const co[3]) /* pass */ } else { - fac = sqrt(fac); + fac = sqrtf(fac); } } else { @@ -338,9 +338,9 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens) /* now we have 2 points, make three lengths with it */ - a= sqrt(p1[0]*p1[0]+p1[1]*p1[1]+p1[2]*p1[2]); - b= sqrt(p2[0]*p2[0]+p2[1]*p2[1]+p2[2]*p2[2]); - c= len_v3v3(p1, p2); + a = len_v3(p1); + b = len_v3(p2); + c = len_v3v3(p1, p2); a/= ladist; a= sqrt(a); @@ -640,7 +640,7 @@ static float Blinn_Spec(const float n[3], const float l[3], const float v[3], fl /* conversion from 'hardness' (1-255) to 'spec_power' (50 maps at 0.1) */ if (spec_power<100.0f) - spec_power= sqrt(1.0f/spec_power); + spec_power = sqrtf(1.0f / spec_power); else spec_power= 10.0f/spec_power; h[0]= v[0]+l[0]; @@ -731,7 +731,7 @@ static float WardIso_Spec(const float n[3], const float l[3], const float v[3], if (tangent) nl = sasqrt(1.0f - nl*nl); if (nl<=0.0f) nl = 0.001f; - angle = tan(saacos(nh)); + angle = tanf(saacos(nh)); alpha = MAX2(rms, 0.001f); i= nl * (1.0f/(4.0f*(float)M_PI*alpha*alpha)) * (expf( -(angle*angle)/(alpha*alpha))/(sqrtf(nv*nl))); @@ -746,7 +746,7 @@ static float Toon_Diff(const float n[3], const float l[3], const float UNUSED(v[ rslt = n[0]*l[0] + n[1]*l[1] + n[2]*l[2]; - ang = saacos( (double)(rslt) ); + ang = saacos(rslt); if ( ang < size ) rslt = 1.0f; else if ( ang >= (size + smooth) || smooth == 0.0f ) rslt = 0.0f; @@ -1257,7 +1257,7 @@ float lamp_get_visibility(LampRen *lar, const float co[3], float lv[3], float *d x = max_ff(fabsf(lvrot[0]/lvrot[2]), fabsf(lvrot[1]/lvrot[2])); /* 1.0f/(sqrt(1+x*x)) is equivalent to cos(atan(x)) */ - inpr= 1.0f/(sqrt(1.0f+x*x)); + inpr = 1.0f / (sqrtf(1.0f + x * x)); } else inpr= 0.0f; } @@ -1494,11 +1494,14 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int add_to_diffuse(shr->shad, shi, is, lashdw[0]*(i_noshad-i)*lacol[0], lashdw[1]*(i_noshad-i)*lacol[1], lashdw[2]*(i_noshad-i)*lacol[2]); } if (i_noshad>0.0f) { - if (passflag & (SCE_PASS_DIFFUSE|SCE_PASS_SHADOW)) { + if (passflag & (SCE_PASS_DIFFUSE|SCE_PASS_SHADOW) || + ((passflag & SCE_PASS_COMBINED) && !(shi->combinedflag & SCE_PASS_SHADOW))) + { add_to_diffuse(shr->diff, shi, is, i_noshad*lacol[0], i_noshad*lacol[1], i_noshad*lacol[2]); } - else + else { copy_v3_v3(shr->diff, shr->shad); + } } } @@ -1648,7 +1651,8 @@ static void shade_lamp_loop_only_shadow(ShadeInput *shi, ShadeResult *shr) else { /* shadowonly_flag == MA_SO_SHADED */ /* Use shaded value */ accum = 1.0f - shaded; - }} + } + } shr->alpha= (shi->alpha)*(accum); if (shr->alpha<0.0f) shr->alpha=0.0f; @@ -1714,7 +1718,7 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr) */ const int color_passes = SCE_PASS_COMBINED | SCE_PASS_RGBA | SCE_PASS_DIFFUSE | SCE_PASS_SPEC | - SCE_PASS_REFLECT | SCE_PASS_NORMAL | SCE_PASS_REFRACT | SCE_PASS_EMIT; + SCE_PASS_REFLECT | SCE_PASS_NORMAL | SCE_PASS_REFRACT | SCE_PASS_EMIT | SCE_PASS_SHADOW; Material *ma= shi->mat; int passflag= shi->passflag; @@ -1889,7 +1893,7 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr) } if (shi->combinedflag & SCE_PASS_SHADOW) - copy_v3_v3(shr->diffshad, shr->shad); /* note, no ';' ! */ + copy_v3_v3(shr->diffshad, shr->shad); else copy_v3_v3(shr->diffshad, shr->diff); diff --git a/source/blender/render/intern/source/sss.c b/source/blender/render/intern/source/sss.c index 52d3815c4ad..7e9003aaee7 100644 --- a/source/blender/render/intern/source/sss.c +++ b/source/blender/render/intern/source/sss.c @@ -165,7 +165,7 @@ static float f_Rd(float alpha_, float A, float ro) { float sq; - sq= sqrt(3.0f*(1.0f - alpha_)); + sq = sqrtf(3.0f * (1.0f - alpha_)); return (alpha_/2.0f)*(1.0f + expf((-4.0f/3.0f)*A*sq))*expf(-sq) - ro; } @@ -212,8 +212,8 @@ static float Rd_rsquare(ScatterSettings *ss, float rr) { float sr, sv, Rdr, Rdv; - sr= sqrt(rr + ss->zr*ss->zr); - sv= sqrt(rr + ss->zv*ss->zv); + sr = sqrtf(rr + ss->zr * ss->zr); + sv = sqrtf(rr + ss->zv * ss->zv); Rdr= ss->zr*(1.0f + ss->sigma*sr)*expf(-ss->sigma*sr)/(sr*sr*sr); Rdv= ss->zv*(1.0f + ss->sigma*sv)*expf(-ss->sigma*sv)/(sv*sv*sv); @@ -241,7 +241,7 @@ static void approximate_Rd_rgb(ScatterSettings **ss, float rr, float *rd) /* pass */ } else if (rr > RD_TABLE_RANGE) { - rr= sqrt(rr); + rr = sqrtf(rr); indexf= rr*(RD_TABLE_SIZE/RD_TABLE_RANGE_2); index= (int)indexf; idxf= (float)index; @@ -286,7 +286,7 @@ static void build_Rd_table(ScatterSettings *ss) r= i*(RD_TABLE_RANGE/RD_TABLE_SIZE); /*if (r < ss->invsigma_t_*ss->invsigma_t_) r= ss->invsigma_t_*ss->invsigma_t_;*/ - ss->tableRd[i]= Rd(ss, sqrt(r)); + ss->tableRd[i]= Rd(ss, sqrtf(r)); r= i*(RD_TABLE_RANGE_2/RD_TABLE_SIZE); /*if (r < ss->invsigma_t_) diff --git a/source/blender/render/intern/source/strand.c b/source/blender/render/intern/source/strand.c index 50343cfaa0b..485680da76f 100644 --- a/source/blender/render/intern/source/strand.c +++ b/source/blender/render/intern/source/strand.c @@ -145,7 +145,7 @@ void strand_eval_point(StrandSegment *sseg, StrandPoint *spoint) w= spoint->co[2]*strandbuf->winmat[2][3] + strandbuf->winmat[3][3]; dx= strandbuf->winx*cross[0]*strandbuf->winmat[0][0]/w; dy= strandbuf->winy*cross[1]*strandbuf->winmat[1][1]/w; - w= sqrt(dx*dx + dy*dy); + w = sqrtf(dx * dx + dy * dy); if (w > 0.0f) { if (strandbuf->flag & R_STRAND_B_UNITS) { diff --git a/source/blender/render/intern/source/sunsky.c b/source/blender/render/intern/source/sunsky.c index 71ef5b8f62f..1836b3f48a7 100644 --- a/source/blender/render/intern/source/sunsky.c +++ b/source/blender/render/intern/source/sunsky.c @@ -89,14 +89,14 @@ void ClipColor(float c[3]) * */ static float AngleBetween(float thetav, float phiv, float theta, float phi) { - float cospsi = sin(thetav) * sin(theta) * cos(phi - phiv) + cos(thetav) * cos(theta); + float cospsi = sinf(thetav) * sinf(theta) * cosf(phi - phiv) + cosf(thetav) * cosf(theta); if (cospsi > 1.0f) return 0; if (cospsi < -1.0f) return M_PI; - return acos(cospsi); + return acosf(cospsi); } /** @@ -112,7 +112,7 @@ static void DirectionToThetaPhi(float *toSun, float *theta, float *phi) if (fabsf(*theta) < 1e-5f) *phi = 0; else - *phi = atan2(toSun[1], toSun[0]); + *phi = atan2f(toSun[1], toSun[0]); } /** diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c index 28849ed7686..87e546ef24e 100644 --- a/source/blender/render/intern/source/zbuf.c +++ b/source/blender/render/intern/source/zbuf.c @@ -2951,7 +2951,7 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float * dvec2[1]= 0.0f; } else { - speedsq= 1.0f - minspeed/sqrt(speedsq); + speedsq = 1.0f - minspeed / sqrtf(speedsq); dvec2[0]= speedsq*dvec1[0]; dvec2[1]= speedsq*dvec1[1]; } @@ -3027,7 +3027,7 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float * if (maxspeed) { float speedsq= dvz[0]*dvz[0] + dvz[1]*dvz[1]; if (speedsq > maxspeedsq) { - speedsq= (float)maxspeed/sqrt(speedsq); + speedsq = (float)maxspeed / sqrtf(speedsq); dvz[0]*= speedsq; dvz[1]*= speedsq; } @@ -3386,7 +3386,7 @@ static int zbuffer_abuf(Render *re, RenderPart *pa, APixstr *APixbuf, ListBase * projectverto(vec, obwinmat, hoco); fval= mul*(1.0f+hoco[2]/hoco[3]); - polygon_offset= (int) fabs(zval - fval ); + polygon_offset= (int)fabsf(zval - fval); } else polygon_offset= 0; diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c index 748303f9082..1abe000a86c 100644 --- a/source/blender/windowmanager/intern/wm_keymap.c +++ b/source/blender/windowmanager/intern/wm_keymap.c @@ -589,8 +589,12 @@ static void wm_keymap_patch(wmKeyMap *km, wmKeyMap *diff_km) /* add item */ if (kmdi->add_item) { + /* Do not re-add an already existing keymap item! See T42088. */ + kmi_add = wm_keymap_find_item_equals(km, kmdi->add_item); + if (!kmi_add) + kmi_add = wm_keymap_find_item_equals_result(km, kmdi->add_item); /* only if nothing to remove or item to remove found */ - if (!kmdi->remove_item || kmi_remove) { + if (!kmi_add && (!kmdi->remove_item || kmi_remove)) { kmi_add = wm_keymap_item_copy(kmdi->add_item); kmi_add->flag |= KMI_USER_MODIFIED; diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index bc79879f1f4..b9a79a85455 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1893,7 +1893,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar col = uiLayoutColumn(split, false); uiItemL(col, IFACE_("Links"), ICON_NONE); uiItemStringO(col, IFACE_("Support an Open Animation Movie"), ICON_URL, "WM_OT_url_open", "url", - "http://cloud.blender.org/gooseberry"); + "https://cloud.blender.org/join"); uiItemStringO(col, IFACE_("Donations"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/foundation/donation-payment/"); uiItemStringO(col, IFACE_("Credits"), ICON_URL, "WM_OT_url_open", "url", @@ -2208,7 +2208,7 @@ static void WM_OT_read_homefile(wmOperatorType *ot) "Load user interface setup from the .blend file"); RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); - /* ommit poll to run in background mode */ + /* omit poll to run in background mode */ } static void WM_OT_read_factory_settings(wmOperatorType *ot) @@ -2219,7 +2219,7 @@ static void WM_OT_read_factory_settings(wmOperatorType *ot) ot->invoke = WM_operator_confirm; ot->exec = wm_homefile_read_exec; - /* ommit poll to run in background mode */ + /* omit poll to run in background mode */ } /* *************** open file **************** */ @@ -2372,7 +2372,7 @@ static void WM_OT_open_mainfile(wmOperatorType *ot) ot->exec = wm_open_mainfile_exec; ot->check = wm_open_mainfile_check; ot->ui = wm_open_mainfile_ui; - /* ommit window poll so this can work in background mode */ + /* omit window poll so this can work in background mode */ WM_operator_properties_filesel(ot, FOLDERFILE | BLENDERFILE, FILE_BLENDER, FILE_OPENFILE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY); @@ -2860,7 +2860,7 @@ static void WM_OT_save_as_mainfile(wmOperatorType *ot) ot->invoke = wm_save_as_mainfile_invoke; ot->exec = wm_save_as_mainfile_exec; ot->check = blend_save_check; - /* ommit window poll so this can work in background mode */ + /* omit window poll so this can work in background mode */ WM_operator_properties_filesel(ot, FOLDERFILE | BLENDERFILE, FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY); @@ -2936,7 +2936,7 @@ static void WM_OT_save_mainfile(wmOperatorType *ot) ot->invoke = wm_save_mainfile_invoke; ot->exec = wm_save_as_mainfile_exec; ot->check = blend_save_check; - /* ommit window poll so this can work in background mode */ + /* omit window poll so this can work in background mode */ WM_operator_properties_filesel(ot, FOLDERFILE | BLENDERFILE, FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY); @@ -3749,8 +3749,8 @@ static void radial_control_set_initial_mouse(RadialControl *rc, const wmEvent *e d[0] = (1 - rc->initial_value) * WM_RADIAL_CONTROL_DISPLAY_WIDTH + WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE; break; case PROP_ANGLE: - d[0] = WM_RADIAL_CONTROL_DISPLAY_SIZE * cos(rc->initial_value); - d[1] = WM_RADIAL_CONTROL_DISPLAY_SIZE * sin(rc->initial_value); + d[0] = WM_RADIAL_CONTROL_DISPLAY_SIZE * cosf(rc->initial_value); + d[1] = WM_RADIAL_CONTROL_DISPLAY_SIZE * sinf(rc->initial_value); break; default: return; @@ -4251,7 +4251,7 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even if (snap) new_value = ((int)ceil(new_value * 10.f) * 10.0f) / 100.f; break; case PROP_ANGLE: - new_value = atan2(delta[1], delta[0]) + M_PI + angle_precision; + new_value = atan2f(delta[1], delta[0]) + M_PI + angle_precision; new_value = fmod(new_value, 2.0f * (float)M_PI); if (new_value < 0.0f) new_value += 2.0f * (float)M_PI; @@ -4354,6 +4354,7 @@ static void redraw_timer_window_swap(bContext *C) { wmWindow *win = CTX_wm_window(C); ScrArea *sa; + CTX_wm_menu_set(C, NULL); for (sa = CTX_wm_screen(C)->areabase.first; sa; sa = sa->next) ED_area_tag_redraw(sa); @@ -4392,7 +4393,8 @@ static int redraw_timer_exec(bContext *C, wmOperator *op) } else if (type == 1) { wmWindow *win = CTX_wm_window(C); - + CTX_wm_menu_set(C, NULL); + ED_region_tag_redraw(ar); wm_draw_update(C); @@ -4405,6 +4407,8 @@ static int redraw_timer_exec(bContext *C, wmOperator *op) ScrArea *sa_back = CTX_wm_area(C); ARegion *ar_back = CTX_wm_region(C); + CTX_wm_menu_set(C, NULL); + for (sa = CTX_wm_screen(C)->areabase.first; sa; sa = sa->next) { ARegion *ar_iter; CTX_wm_area_set(C, sa); diff --git a/source/blender/windowmanager/intern/wm_playanim.c b/source/blender/windowmanager/intern/wm_playanim.c index 024135e73e9..76add2f9aac 100644 --- a/source/blender/windowmanager/intern/wm_playanim.c +++ b/source/blender/windowmanager/intern/wm_playanim.c @@ -98,6 +98,8 @@ typedef struct PlayState { bool go; /* waiting for images to load */ bool loading; + /* x/y image flip */ + bool draw_flip[2]; int fstep; @@ -168,6 +170,15 @@ static void playanim_window_get_size(int *width_r, int *height_r) GHOST_DisposeRectangle(bounds); } +static void playanim_gl_matrix(void) +{ + /* unified matrix, note it affects offset for drawing */ + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(0.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f); + glMatrixMode(GL_MODELVIEW); +} + /* implementation */ static void playanim_event_qual_update(void) { @@ -245,7 +256,8 @@ static int pupdate_time(void) static void playanim_toscreen(PlayState *ps, PlayAnimPict *picture, struct ImBuf *ibuf, int fontid, int fstep) { - float offsx, offsy; + float offs_x, offs_y; + float span_x, span_y; if (ibuf == NULL) { printf("%s: no ibuf for picture '%s'\n", __func__, picture ? picture->name : "<NIL>"); @@ -260,13 +272,17 @@ static void playanim_toscreen(PlayState *ps, PlayAnimPict *picture, struct ImBuf GHOST_ActivateWindowDrawingContext(g_WS.ghost_window); + /* size within window */ + span_x = (ps->zoom * ibuf->x) / (float)ps->win_x; + span_y = (ps->zoom * ibuf->y) / (float)ps->win_y; + /* offset within window */ - offsx = 0.5f * (((float)ps->win_x - ps->zoom * ibuf->x) / (float)ps->win_x); - offsy = 0.5f * (((float)ps->win_y - ps->zoom * ibuf->y) / (float)ps->win_y); + offs_x = 0.5f * (1.0f - span_x); + offs_y = 0.5f * (1.0f - span_y); - CLAMP(offsx, 0.0f, 1.0f); - CLAMP(offsy, 0.0f, 1.0f); - glRasterPos2f(offsx, offsy); + CLAMP(offs_x, 0.0f, 1.0f); + CLAMP(offs_y, 0.0f, 1.0f); + glRasterPos2f(offs_x, offs_y); glClearColor(0.1, 0.1, 0.1, 0.0); glClear(GL_COLOR_BUFFER_BIT); @@ -276,9 +292,15 @@ static void playanim_toscreen(PlayState *ps, PlayAnimPict *picture, struct ImBuf glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - fdrawcheckerboard(offsx, offsy, offsx + (ps->zoom * ibuf->x) / (float)ps->win_x, offsy + (ps->zoom * ibuf->y) / (float)ps->win_y); + fdrawcheckerboard(offs_x, offs_y, offs_x + span_x, offs_y + span_y); } - + + glRasterPos2f(offs_x + (ps->draw_flip[0] ? span_x : 0.0f), + offs_y + (ps->draw_flip[1] ? span_y : 0.0f)); + + glPixelZoom(ps->zoom * ps->draw_flip[0] ? -1.0f : 1.0f, + ps->zoom * ps->draw_flip[1] ? -1.0f : 1.0f); + glDrawPixels(ibuf->x, ibuf->y, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect); glDisable(GL_BLEND); @@ -518,6 +540,14 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void) case GHOST_kKeyP: if (val) ps->pingpong = !ps->pingpong; break; + case GHOST_kKeyF: + { + if (val) { + int axis = (g_WS.qual & WS_QUAL_SHIFT) ? 1 : 0; + ps->draw_flip[axis] = !ps->draw_flip[axis]; + } + break; + } case GHOST_kKey1: case GHOST_kKeyNumpad1: if (val) swaptime = ps->fstep / 60.0; @@ -780,13 +810,8 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void) glViewport(0, 0, ps->win_x, ps->win_y); glScissor(0, 0, ps->win_x, ps->win_y); - /* unified matrix, note it affects offset for drawing */ - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(0.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f); - glMatrixMode(GL_MODELVIEW); + playanim_gl_matrix(); - glPixelZoom(ps->zoom, ps->zoom); ptottime = 0.0; playanim_toscreen(ps, ps->picture, ps->curframe_ibuf, ps->fontid, ps->fstep); @@ -891,6 +916,8 @@ static char *wm_main_playanim_intern(int argc, const char **argv) ps.dropped_file[0] = 0; ps.zoom = 1.0f; /* resetmap = false */ + ps.draw_flip[0] = false; + ps.draw_flip[1] = false; ps.fstep = 1; @@ -1008,11 +1035,7 @@ static char *wm_main_playanim_intern(int argc, const char **argv) playanim_window_open("Blender:Anim", start_x, start_y, ibuf->x, ibuf->y); - /* unified matrix, note it affects offset for drawing */ - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(0.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f); - glMatrixMode(GL_MODELVIEW); + playanim_gl_matrix(); } GHOST_GetMainDisplayDimensions(g_WS.ghost_system, &maxwinx, &maxwiny); diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 20e5b1d8353..46a20d3bf88 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -339,6 +339,19 @@ void wm_window_title(wmWindowManager *wm, wmWindow *win) } } +float wm_window_pixelsize(wmWindow *win) +{ + float pixelsize = GHOST_GetNativePixelSize(win->ghostwin); + + switch (U.virtual_pixel) { + default: + case VIRTUAL_PIXEL_NATIVE: + return pixelsize; + case VIRTUAL_PIXEL_DOUBLE: + return 2.0f * pixelsize; + } +} + /* belongs to below */ static void wm_window_add_ghostwindow(wmWindowManager *wm, const char *title, wmWindow *win) { @@ -400,7 +413,7 @@ static void wm_window_add_ghostwindow(wmWindowManager *wm, const char *title, wm /* displays with larger native pixels, like Macbook. Used to scale dpi with */ /* needed here, because it's used before it reads userdef */ - U.pixelsize = GHOST_GetNativePixelSize(win->ghostwin); + U.pixelsize = wm_window_pixelsize(win); BKE_userdef_state(); wm_window_swap_buffers(win); @@ -688,7 +701,7 @@ void wm_window_make_drawable(wmWindowManager *wm, wmWindow *win) GHOST_ActivateWindowDrawingContext(win->ghostwin); /* this can change per window */ - U.pixelsize = GHOST_GetNativePixelSize(win->ghostwin); + U.pixelsize = wm_window_pixelsize(win); BKE_userdef_state(); } } @@ -1048,7 +1061,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr case GHOST_kEventNativeResolutionChange: // printf("change, pixel size %f\n", GHOST_GetNativePixelSize(win->ghostwin)); - U.pixelsize = GHOST_GetNativePixelSize(win->ghostwin); + U.pixelsize = wm_window_pixelsize(win); BKE_userdef_state(); WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL); WM_event_add_notifier(C, NC_WINDOW | NA_EDITED, NULL); diff --git a/source/blender/windowmanager/wm_window.h b/source/blender/windowmanager/wm_window.h index a71e0fd9fc9..9c9c79d2f54 100644 --- a/source/blender/windowmanager/wm_window.h +++ b/source/blender/windowmanager/wm_window.h @@ -61,6 +61,8 @@ void wm_window_swap_buffers (wmWindow *win); void wm_window_set_swap_interval(wmWindow *win, int interval); bool wm_window_get_swap_interval(wmWindow *win, int *intervalOut); +float wm_window_pixelsize(wmWindow *win); + void wm_get_cursor_position (wmWindow *win, int *x, int *y); wmWindow *wm_window_copy (bContext *C, wmWindow *winorig); diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c index 97e7d99c802..649ea1f59c7 100644 --- a/source/blenderplayer/bad_level_call_stubs/stubs.c +++ b/source/blenderplayer/bad_level_call_stubs/stubs.c @@ -142,6 +142,7 @@ struct wmWindowManager; #include "../../intern/dualcon/dualcon.h" #include "../../intern/elbeem/extern/elbeem.h" #include "../blender/blenkernel/BKE_modifier.h" +#include "../blender/blenkernel/BKE_paint.h" #include "../blender/collada/collada.h" #include "../blender/compositor/COM_compositor.h" #include "../blender/editors/include/ED_armature.h" @@ -168,6 +169,7 @@ struct wmWindowManager; #include "../blender/editors/include/UI_interface_icons.h" #include "../blender/editors/include/UI_resources.h" #include "../blender/editors/include/UI_view2d.h" +#include "../blender/freestyle/FRS_freestyle.h" #include "../blender/python/BPY_extern.h" #include "../blender/render/extern/include/RE_engine.h" #include "../blender/render/extern/include/RE_pipeline.h" @@ -229,6 +231,7 @@ void ibuf_sample(struct ImBuf *ibuf, float fx, float fy, float dx, float dy, flo /* Freestyle */ bool ED_texture_context_check_linestyle(const struct bContext *C) RET_ZERO +void FRS_free_view_map_cache(void) RET_NONE /* texture.c */ int multitex_ext(struct Tex *tex, float texvec[3], float dxt[3], float dyt[3], int osatex, struct TexResult *texres, struct ImagePool *pool, bool scene_color_manage) RET_ZERO @@ -245,6 +248,9 @@ struct Render *RE_GetRender(const char *name) RET_NULL float RE_lamp_get_data(struct ShadeInput *shi, struct Object *lamp_obj, float col[4], float lv[3], float *dist, float shadow[4]) RET_ZERO /* blenkernel */ +bool BKE_paint_proj_mesh_data_check(struct Scene *scene, struct Object *ob, bool *uvs, bool *mat, bool *tex, bool *stencil) RET_ZERO + +/* render */ void RE_FreeRenderResult(struct RenderResult *res) RET_NONE void RE_FreeAllRenderResults(void) RET_NONE struct RenderResult *RE_MultilayerConvert(void *exrhandle, const char *colorspace, bool predivide, int rectx, int recty) RET_NULL diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 56b017c14dc..20c2448eed3 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -52,6 +52,11 @@ if(WITH_LIBMV) add_definitions(-DWITH_LIBMV) endif() +if(WITH_CYCLES AND WITH_CYCLES_LOGGING) + blender_include_dirs(../../intern/cycles/blender) + add_definitions(-DWITH_CYCLES_LOGGING) +endif() + if(WITH_CODEC_FFMPEG) add_definitions(-DWITH_FFMPEG) endif() diff --git a/source/creator/creator.c b/source/creator/creator.c index 768a323a169..12ae5c502e4 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -149,6 +149,10 @@ # include "libmv-capi.h" #endif +#ifdef WITH_CYCLES_LOGGING +# include "CCL_api.h" +#endif + /* from buildinfo.c */ #ifdef BUILD_DATE extern char build_date[]; @@ -309,6 +313,9 @@ static int print_help(int UNUSED(argc), const char **UNUSED(argv), void *data) #ifdef WITH_LIBMV BLI_argsPrintArgDoc(ba, "--debug-libmv"); #endif +#ifdef WITH_CYCLES_LOGGING + BLI_argsPrintArgDoc(ba, "--debug-cycles"); +#endif BLI_argsPrintArgDoc(ba, "--debug-memory"); BLI_argsPrintArgDoc(ba, "--debug-jobs"); BLI_argsPrintArgDoc(ba, "--debug-python"); @@ -450,6 +457,15 @@ static int debug_mode_libmv(int UNUSED(argc), const char **UNUSED(argv), void *U } #endif +#ifdef WITH_CYCLES_LOGGING +static int debug_mode_cycles(int UNUSED(argc), const char **UNUSED(argv), + void *UNUSED(data)) +{ + CCL_start_debug_logging(); + return 0; +} +#endif + static int debug_mode_memory(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data)) { MEM_set_memory_debug(); @@ -887,6 +903,8 @@ static int set_verbosity(int argc, const char **argv, void *UNUSED(data)) #ifdef WITH_LIBMV libmv_setLoggingVerbosity(level); +#elif defined(WITH_CYCLES_LOGGING) + CCL_logging_verbosity_set(level); #else (void)level; #endif @@ -1419,6 +1437,9 @@ static void setupArguments(bContext *C, bArgs *ba, SYS_SystemHandle *syshandle) #ifdef WITH_LIBMV BLI_argsAdd(ba, 1, NULL, "--debug-libmv", "\n\tEnable debug messages from libmv library", debug_mode_libmv, NULL); #endif +#ifdef WITH_CYCLES_LOGGING + BLI_argsAdd(ba, 1, NULL, "--debug-cycles", "\n\tEnable debug messages from Cycles", debug_mode_cycles, NULL); +#endif BLI_argsAdd(ba, 1, NULL, "--debug-memory", "\n\tEnable fully guarded memory allocation and debugging", debug_mode_memory, NULL); BLI_argsAdd(ba, 1, NULL, "--debug-value", "<value>\n\tSet debug value of <value> on startup\n", set_debug_value, NULL); @@ -1508,9 +1529,9 @@ int main( #endif #ifdef WIN32 - /* FMA3 support in the 2013 CRT is broken on Vista and Windows 7 RTM (fixed in SP1). Just disable it. */ + /* FMA3 support in the 2013 CRT is broken on Vista and Windows 7 RTM (fixed in SP1). Just disable it. */ # if defined(_MSC_VER) && _MSC_VER >= 1800 && defined(_M_X64) - _set_FMA3_enable(0); + _set_FMA3_enable(0); # endif /* Win32 Unicode Args */ @@ -1583,6 +1604,8 @@ int main( #ifdef WITH_LIBMV libmv_initLogging(argv[0]); +#elif defined(WITH_CYCLES_LOGGING) + CCL_init_logging(argv[0]); #endif setCallbacks(); diff --git a/source/creator/creator_launch_win.c b/source/creator/creator_launch_win.c index a7e04b2dafc..03f28cd4034 100644 --- a/source/creator/creator_launch_win.c +++ b/source/creator/creator_launch_win.c @@ -58,9 +58,14 @@ int main(int argc, const char **UNUSED(argv_c)) wcsncpy(command, BLENDER_BINARY, len - 1); len -= wcslen(BLENDER_BINARY); for (i = 1; i < argc; ++i) { + size_t argument_len = wcslen(argv_16[i]); wcsncat(command, L" \"", len - 2); wcsncat(command, argv_16[i], len - 3); - len -= wcslen(argv_16[i]) + 1; + len -= argument_len + 1; + if (argv_16[i][argument_len - 1] == '\\') { + wcsncat(command, L"\\", len - 1); + len--; + } wcsncat(command, L"\"", len - 1); } diff --git a/source/creator/osx_locals.map b/source/creator/osx_locals.map index a1d7e7fed57..8405be74ab7 100644 --- a/source/creator/osx_locals.map +++ b/source/creator/osx_locals.map @@ -2,4 +2,7 @@ ## (aka visibility=hidden) and will not be global in the output file *boost* *__ZNSt6vector* +*llvm* +*LLVM* +*OSL* diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index a7c98eb9dc1..2a7e631637e 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -67,6 +67,7 @@ extern "C" { + #include "DNA_object_types.h" #include "DNA_view3d_types.h" #include "DNA_screen_types.h" #include "DNA_userdef_types.h" @@ -282,6 +283,10 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c bool mouse_state = startscene->gm.flag & GAME_SHOW_MOUSE; bool restrictAnimFPS = startscene->gm.flag & GAME_RESTRICT_ANIM_UPDATES; + short drawtype = v3d->drawtype; + + /* we do not support material mode in game engine, force change to texture mode */ + if (drawtype == OB_MATERIAL) drawtype = OB_TEXTURE; if (animation_record) usefixed= false; /* override since you don't want to run full-speed for sim recording */ // create the canvas and rasterizer @@ -371,7 +376,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c camzoom = 2.0; } - rasterizer->SetDrawingMode(v3d->drawtype); + rasterizer->SetDrawingMode(drawtype); ketsjiengine->SetCameraZoom(camzoom); // if we got an exitcode 3 (KX_EXIT_REQUEST_START_OTHER_GAME) load a different file diff --git a/source/gameengine/Converter/BL_ArmatureObject.cpp b/source/gameengine/Converter/BL_ArmatureObject.cpp index 8d73e591113..e01130a8970 100644 --- a/source/gameengine/Converter/BL_ArmatureObject.cpp +++ b/source/gameengine/Converter/BL_ArmatureObject.cpp @@ -101,7 +101,7 @@ static void game_copy_pose(bPose **dst, bPose *src, int copy_constraint) out->chanhash = NULL; out->agroups.first= out->agroups.last= NULL; out->ikdata = NULL; - out->ikparam = MEM_dupallocN(src->ikparam); + out->ikparam = MEM_dupallocN(src->ikparam); out->flag |= POSE_GAME_ENGINE; BLI_duplicatelist(&out->chanbase, &src->chanbase); diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp index 14772cda113..f76580cd44d 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp @@ -1734,18 +1734,17 @@ void KX_KetsjiEngine::AddScheduledScenes() bool KX_KetsjiEngine::ReplaceScene(const STR_String& oldscene,const STR_String& newscene) { - // Don't allow replacement if the new scene doesn't exists. - // Allows smarter game design (used to have no check here). - // Note that it creates a small backward compatbility issue - // for a game that did a replace followed by a lib load with the - // new scene in the lib => it won't work anymore, the lib - // must be loaded before doing the replace. - if (m_sceneconverter->GetBlenderSceneForName(newscene) != NULL) - { - m_replace_scenes.push_back(std::make_pair(oldscene,newscene)); - return true; - } - return false; + // Don't allow replacement if the new scene doesn't exists. + // Allows smarter game design (used to have no check here). + // Note that it creates a small backward compatbility issue + // for a game that did a replace followed by a lib load with the + // new scene in the lib => it won't work anymore, the lib + // must be loaded before doing the replace. + if (m_sceneconverter->GetBlenderSceneForName(newscene) != NULL) { + m_replace_scenes.push_back(std::make_pair(oldscene,newscene)); + return true; + } + return false; } // replace scene is not the same as removing and adding because the @@ -1767,21 +1766,20 @@ void KX_KetsjiEngine::ReplaceScheduledScenes() int i=0; /* Scenes are not supposed to be included twice... I think */ KX_SceneList::iterator sceneit; - for (sceneit = m_scenes.begin();sceneit != m_scenes.end() ; sceneit++) - { - KX_Scene* scene = *sceneit; - if (scene->GetName() == oldscenename) - { - // avoid crash if the new scene doesn't exist, just do nothing - Scene *blScene = m_sceneconverter->GetBlenderSceneForName(newscenename); - if (blScene) { - m_sceneconverter->RemoveScene(scene); - KX_Scene* tmpscene = CreateScene(blScene); - m_scenes[i]=tmpscene; - PostProcessScene(tmpscene); - } else { - printf("warning: scene %s could not be found, not replaced!\n",newscenename.ReadPtr()); - } + for (sceneit = m_scenes.begin();sceneit != m_scenes.end() ; sceneit++) { + KX_Scene* scene = *sceneit; + if (scene->GetName() == oldscenename) { + // avoid crash if the new scene doesn't exist, just do nothing + Scene *blScene = m_sceneconverter->GetBlenderSceneForName(newscenename); + if (blScene) { + m_sceneconverter->RemoveScene(scene); + KX_Scene* tmpscene = CreateScene(blScene); + m_scenes[i]=tmpscene; + PostProcessScene(tmpscene); + } + else { + printf("warning: scene %s could not be found, not replaced!\n",newscenename.ReadPtr()); + } } i++; } diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index 625bbee2c8e..d0eab9de1c1 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -1577,7 +1577,7 @@ void KX_Scene::AddAnimatedObject(CValue* gameobj) static void update_anim_thread_func(TaskPool *pool, void *taskdata, int UNUSED(threadid)) { - KX_GameObject *gameobj, *child; + KX_GameObject *gameobj, *child, *parent; CListValue *children; bool needs_update; double curtime = *(double*)BLI_task_pool_userdata(pool); @@ -1621,8 +1621,11 @@ static void update_anim_thread_func(TaskPool *pool, void *taskdata, int UNUSED(t if (needs_update) { gameobj->UpdateActionManager(curtime); children = gameobj->GetChildren(); + parent = gameobj->GetParent(); - if (!gameobj->GetParent() && gameobj->GetDeformer()) + // Only do deformers here if they are not parented to an armature, otherwise the armature will + // handle updating its children + if (gameobj->GetDeformer() && (!parent || (parent && parent->GetGameObjectType() != SCA_IObject::OBJ_ARMATURE))) gameobj->GetDeformer()->Update(); for (int j=0; j<children->GetCount(); ++j) { |