diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_subsurf.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/appdir.c | 46 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/collision.c | 12 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/subsurf_ccg.c | 9 | ||||
-rw-r--r-- | source/blender/blenlib/intern/storage.c | 4 | ||||
-rw-r--r-- | source/blender/blenlib/intern/system.c | 4 | ||||
-rw-r--r-- | source/blender/blentranslation/msgfmt/msgfmt.c | 3 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/builder/deg_builder_nodes.cc | 3 | ||||
-rw-r--r-- | source/blender/editors/armature/armature_select.c | 31 | ||||
-rw-r--r-- | source/blender/editors/space_image/image_buttons.c | 2 | ||||
-rw-r--r-- | source/blender/imbuf/intern/indexer.c | 6 | ||||
-rw-r--r-- | source/blender/imbuf/intern/openexr/openexr_api.cpp | 18 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_image.c | 2 | ||||
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.c | 2 |
14 files changed, 95 insertions, 49 deletions
diff --git a/source/blender/blenkernel/BKE_subsurf.h b/source/blender/blenkernel/BKE_subsurf.h index f52bb2ab9cb..92170325113 100644 --- a/source/blender/blenkernel/BKE_subsurf.h +++ b/source/blender/blenkernel/BKE_subsurf.h @@ -125,6 +125,8 @@ typedef struct CCGDerivedMesh { struct CCGFace **gridFaces; struct DMFlagMat *gridFlagMats; unsigned int **gridHidden; + /* Elements in arrays above. */ + unsigned int numGrid; struct { struct MultiresModifierData *mmd; diff --git a/source/blender/blenkernel/intern/appdir.c b/source/blender/blenkernel/intern/appdir.c index 6dd852c7875..8d4776dca0e 100644 --- a/source/blender/blenkernel/intern/appdir.c +++ b/source/blender/blenkernel/intern/appdir.c @@ -290,6 +290,33 @@ static bool get_path_user( } /** + * Special convenience exception for dev builds to allow overrides to the system path. + * With this, need for running 'make install' can be avoided, e.g. by symlinking SOURCE_DIR/release + * to EXECUTABLE_DIR/release, or by running Blender from source directory directly. + */ +static bool get_path_system_dev_build_exception( + char *targetpath, size_t targetpath_len, const char *relfolder) +{ + char cwd[FILE_MAX]; + + /* Try EXECUTABLE_DIR/release/folder_name. Allows symlinking release folder from source dir. */ + if (test_path(targetpath, targetpath_len, bprogdir, "release", relfolder)) { + return true; + } + /* Try CWD/release/folder_name. Allows executing Blender from any directory + * (usually source dir), even without a release dir in bprogdir. */ + if (BLI_current_working_dir(cwd, sizeof(cwd))) { + if (test_path(targetpath, targetpath_len, cwd, "release", relfolder)) { + return true; + } + } + /* never use if not existing. */ + targetpath[0] = '\0'; + + return false; +} + +/** * Returns the path of a folder within the Blender installation directory. * * \param targetpath String to return path @@ -305,7 +332,6 @@ static bool get_path_system( { char system_path[FILE_MAX]; const char *system_base_path; - char cwd[FILE_MAX]; char relfolder[FILE_MAX]; if (folder_name) { @@ -320,25 +346,9 @@ static bool get_path_system( relfolder[0] = '\0'; } - /* first allow developer only overrides to the system path - * these are only used when running blender from source */ - - /* try CWD/release/folder_name */ - if (BLI_current_working_dir(cwd, sizeof(cwd))) { - if (test_path(targetpath, targetpath_len, cwd, "release", relfolder)) { - return true; - } - } - /* try EXECUTABLE_DIR/release/folder_name */ - if (test_path(targetpath, targetpath_len, bprogdir, "release", relfolder)) { + if (get_path_system_dev_build_exception(targetpath, targetpath_len, relfolder)) { return true; } - /* never use if not existing. */ - targetpath[0] = '\0'; - - /* end developer overrides */ - - system_path[0] = '\0'; diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c index bc50fdd5a11..a004d32847a 100644 --- a/source/blender/blenkernel/intern/collision.c +++ b/source/blender/blenkernel/intern/collision.c @@ -1148,9 +1148,10 @@ static CollPair *cloth_point_collision( return collpair; } -static void cloth_points_objcollisions_nearcheck(ClothModifierData * clmd, CollisionModifierData *collmd, - CollPair **collisions, CollPair **collisions_index, - int numresult, BVHTreeOverlap *overlap, float epsilon, double dt) +static void cloth_points_objcollisions_nearcheck( + ClothModifierData *clmd, CollisionModifierData *collmd, + CollPair **collisions, CollPair **collisions_index, + int numresult, BVHTreeOverlap *overlap, float epsilon, double dt) { int i; @@ -1164,8 +1165,9 @@ static void cloth_points_objcollisions_nearcheck(ClothModifierData * clmd, Colli } } -static int cloth_points_objcollisions_resolve(ClothModifierData * clmd, CollisionModifierData *collmd, PartDeflect *pd, - CollPair *collisions, CollPair *collisions_index, float dt) +static int cloth_points_objcollisions_resolve( + ClothModifierData *clmd, CollisionModifierData *collmd, PartDeflect *pd, + CollPair *collisions, CollPair *collisions_index, float dt) { Cloth *cloth = clmd->clothObject; int i = 0, mvert_num = clmd->clothObject->mvert_num; diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index d461e03fcda..2f9a7090caf 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -3777,10 +3777,12 @@ static void ccgDM_release(DerivedMesh *dm) if (ccgdm->gridOffset) MEM_freeN(ccgdm->gridOffset); if (ccgdm->gridFlagMats) MEM_freeN(ccgdm->gridFlagMats); if (ccgdm->gridHidden) { - int i, numGrids = dm->getNumGrids(dm); - for (i = 0; i < numGrids; i++) { - if (ccgdm->gridHidden[i]) + /* Using dm->getNumGrids(dm) accesses freed memory */ + uint numGrids = ccgdm->numGrid; + for (uint i = 0; i < numGrids; i++) { + if (ccgdm->gridHidden[i]) { MEM_freeN(ccgdm->gridHidden[i]); + } } MEM_freeN(ccgdm->gridHidden); } @@ -4084,6 +4086,7 @@ static void ccgdm_create_grids(DerivedMesh *dm) ccgdm->gridFaces = gridFaces; ccgdm->gridOffset = gridOffset; ccgdm->gridFlagMats = gridFlagMats; + ccgdm->numGrid = numGrids; } static CCGElem **ccgDM_getGridData(DerivedMesh *dm) diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index a48c8b074dd..e31659c35d9 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -389,11 +389,7 @@ LinkNode *BLI_file_read_as_lines(const char *name) for (i = 0; i <= size; i++) { if (i == size || buf[i] == '\n') { char *line = BLI_strdupn(&buf[last], i - last); - BLI_linklist_append(&lines, line); - /* faster to build singly-linked list in reverse order */ - /* alternatively, could process buffer in reverse order so - * list ends up right way round to start with */ last = i + 1; } } diff --git a/source/blender/blenlib/intern/system.c b/source/blender/blenlib/intern/system.c index 863622f2546..ecb977c6e61 100644 --- a/source/blender/blenlib/intern/system.c +++ b/source/blender/blenlib/intern/system.c @@ -50,8 +50,8 @@ int BLI_cpu_support_sse2(void) "pushl %%ebx\n\t" "cpuid\n\t" "popl %%ebx\n\t" - : "=d" (d) - : "a" (1)); + : "=d" (d) + : "a" (1)); return (d & 0x04000000) != 0; #elif (defined(_MSC_VER) && defined(_M_IX86)) /* also check cpuid for MSVC x86 */ diff --git a/source/blender/blentranslation/msgfmt/msgfmt.c b/source/blender/blentranslation/msgfmt/msgfmt.c index 3abce7b1d3f..49f850f200c 100644 --- a/source/blender/blentranslation/msgfmt/msgfmt.c +++ b/source/blender/blentranslation/msgfmt/msgfmt.c @@ -184,7 +184,8 @@ typedef struct Offset { } Offset; /* Return the generated binary output. */ -static char *generate(GHash *messages, size_t *r_output_size) { +static char *generate(GHash *messages, size_t *r_output_size) +{ const uint32_t num_keys = BLI_ghash_size(messages); /* Get list of sorted keys. */ diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index 3e7ea039cad..a78a636d070 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -1000,7 +1000,8 @@ void DepsgraphNodeBuilder::build_obdata_geom(Object *ob) (MetaBall *)obdata_cow), DEG_OPCODE_PLACEHOLDER, "Geometry Eval"); - } else { + } + else { op_node = add_operation_node(obdata, DEG_NODE_TYPE_GEOMETRY, NULL, diff --git a/source/blender/editors/armature/armature_select.c b/source/blender/editors/armature/armature_select.c index 49619e13065..2c3c8ef4541 100644 --- a/source/blender/editors/armature/armature_select.c +++ b/source/blender/editors/armature/armature_select.c @@ -38,7 +38,7 @@ #include "BLI_string_utils.h" #include "BKE_context.h" -//#include "BKE_deform.h" +#include "BKE_action.h" #include "BKE_report.h" #include "BIF_gl.h" @@ -807,6 +807,7 @@ enum { SIMEDBONE_PREFIX, SIMEDBONE_SUFFIX, SIMEDBONE_LAYER, + SIMEDBONE_SHAPE, }; static const EnumPropertyItem prop_similar_types[] = { @@ -818,6 +819,7 @@ static const EnumPropertyItem prop_similar_types[] = { {SIMEDBONE_PREFIX, "PREFIX", 0, "Prefix", ""}, {SIMEDBONE_SUFFIX, "SUFFIX", 0, "Suffix", ""}, {SIMEDBONE_LAYER, "LAYER", 0, "Layer", ""}, + {SIMEDBONE_SHAPE, "SHAPE", 0, "Shape", ""}, {0, NULL, 0, NULL, NULL} }; @@ -920,7 +922,27 @@ static void select_similar_suffix(bArmature *arm, EditBone *ebone_act) } } -static void is_ancestor(EditBone * bone, EditBone * ancestor) +/** Use for matching any pose channel data. */ +static void select_similar_data_pchan( + bArmature *arm, Object *obj, EditBone *ebone_active, + const size_t bytes_size, const int offset) +{ + const bPoseChannel *pchan_active = BKE_pose_channel_find_name(obj->pose, ebone_active->name); + const char *data_active = (const char *)POINTER_OFFSET(pchan_active, offset); + for (EditBone *ebone = arm->edbo->first; ebone; ebone = ebone->next) { + if (EBONE_SELECTABLE(arm, ebone)) { + const bPoseChannel *pchan = BKE_pose_channel_find_name(obj->pose, ebone->name); + if (pchan) { + const char *data_test = (const char *)POINTER_OFFSET(pchan, offset); + if (memcmp(data_active, data_test, bytes_size) == 0) { + ED_armature_ebone_select_set(ebone, true); + } + } + } + } +} + +static void is_ancestor(EditBone *bone, EditBone *ancestor) { if (bone->temp.ebone == ancestor || bone->temp.ebone == NULL) return; @@ -1012,6 +1034,11 @@ static int armature_select_similar_exec(bContext *C, wmOperator *op) case SIMEDBONE_LAYER: select_similar_layer(arm, ebone_act); break; + case SIMEDBONE_SHAPE: + select_similar_data_pchan( + arm, obedit, ebone_act, + sizeof(void *), offsetof(bPoseChannel, custom)); + break; } WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, obedit); diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index d2897c7264b..51ccaf6800a 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -433,7 +433,7 @@ static void ui_imageuser_pass_menu(bContext *UNUSED(C), uiLayout *layout, void * uiItemS(layout); - nr = (rl == NULL)? 1: 0; + nr = (rl == NULL) ? 1 : 0; ListBase added_passes; BLI_listbase_clear(&added_passes); diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c index e1b3abcf2f6..009258079ee 100644 --- a/source/blender/imbuf/intern/indexer.c +++ b/source/blender/imbuf/intern/indexer.c @@ -843,9 +843,9 @@ static void index_rebuild_ffmpeg_finish(FFmpegIndexBuilderContext *context, int } static void index_rebuild_ffmpeg_proc_decoded_frame( - FFmpegIndexBuilderContext *context, - AVPacket * curr_packet, - AVFrame *in_frame) + FFmpegIndexBuilderContext *context, + AVPacket *curr_packet, + AVFrame *in_frame) { int i; unsigned long long s_pos = context->seek_pos; diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index 451869415e7..ca534e3e2a8 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -414,11 +414,13 @@ static bool imb_save_openexr_half( frameBuffer.insert("R", Slice(HALF, (char *) &to->r, xstride, ystride)); frameBuffer.insert("G", Slice(HALF, (char *) &to->g, xstride, ystride)); frameBuffer.insert("B", Slice(HALF, (char *) &to->b, xstride, ystride)); - if (is_alpha) + if (is_alpha) { frameBuffer.insert("A", Slice(HALF, (char *) &to->a, xstride, ystride)); - if (is_zbuf) + } + if (is_zbuf) { frameBuffer.insert("Z", Slice(Imf::FLOAT, (char *)(ibuf->zbuf_float + (height - 1) * width), - sizeof(float), sizeof(float) * -width)); + sizeof(float), sizeof(float) * -width)); + } if (ibuf->rect_float) { float *from; @@ -509,11 +511,13 @@ static bool imb_save_openexr_float( frameBuffer.insert("R", Slice(Imf::FLOAT, (char *)rect[0], xstride, ystride)); frameBuffer.insert("G", Slice(Imf::FLOAT, (char *)rect[1], xstride, ystride)); frameBuffer.insert("B", Slice(Imf::FLOAT, (char *)rect[2], xstride, ystride)); - if (is_alpha) + if (is_alpha) { frameBuffer.insert("A", Slice(Imf::FLOAT, (char *)rect[3], xstride, ystride)); - if (is_zbuf) + } + if (is_zbuf) { frameBuffer.insert("Z", Slice(Imf::FLOAT, (char *) (ibuf->zbuf_float + (height - 1) * width), - sizeof(float), sizeof(float) * -width)); + sizeof(float), sizeof(float) * -width)); + } file.setFrameBuffer(frameBuffer); file.writePixels(height); @@ -1125,7 +1129,7 @@ void IMB_exr_read_channels(void *handle) ExrChannel *echan; for (echan = (ExrChannel *)data->channels.first; echan; echan = echan->next) { - if(echan->m->part_number != i) { + if (echan->m->part_number != i) { continue; } diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index 75d9c1fe7fb..d516692ec28 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -176,7 +176,7 @@ static void rna_ImageUser_update(Main *UNUSED(bmain), Scene *scene, PointerRNA * BKE_image_user_frame_calc(iuser, scene->r.cfra, 0); - if(ptr->id.data) { + if (ptr->id.data) { /* Update material or texture for render preview. */ DEG_id_tag_update(ptr->id.data, 0); } diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.c b/source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.c index 006bd0cc8bb..8748c884a25 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.c +++ b/source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.c @@ -66,7 +66,7 @@ static void node_shader_free_tex_pointdensity(bNode *node) MEM_freeN(point_density); } -static void node_shader_copy_tex_pointdensity(bNodeTree * UNUSED(dest_ntree), +static void node_shader_copy_tex_pointdensity(bNodeTree *UNUSED(dest_ntree), bNode *dest_node, bNode *src_node) { |