diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2016-12-23 17:36:16 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2016-12-23 17:36:16 +0300 |
commit | 605263177b8eea24c1449e4dbf0138175ec3dddf (patch) | |
tree | ea297c777bcfae7c647ca88c48b8df3f8f3bd843 | |
parent | 76c4f0ec6c61bdc33ae908849f632771a1f997c0 (diff) | |
parent | b47c912f4be877bf5511117864dfc2a5b30c0dca (diff) |
Merge remote-tracking branch 'origin/master' into blender2.8
-rw-r--r-- | intern/libmv/intern/frame_accessor.cc | 3 | ||||
-rw-r--r-- | intern/opensubdiv/opensubdiv_evaluator_capi.cc | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_effect.h | 16 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_gpencil.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/effect.c | 16 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 94 | ||||
-rw-r--r-- | source/blender/editors/space_image/image_ops.c | 5 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawsimdebug.c | 20 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_ID.h | 6 | ||||
-rw-r--r-- | source/blender/makesrna/intern/makesrna.c | 2 | ||||
-rw-r--r-- | source/blenderplayer/bad_level_call_stubs/stubs.c | 2 | ||||
-rw-r--r-- | source/creator/creator_args.c | 2 |
12 files changed, 140 insertions, 32 deletions
diff --git a/intern/libmv/intern/frame_accessor.cc b/intern/libmv/intern/frame_accessor.cc index 9213cc311b3..5d274d7ccca 100644 --- a/intern/libmv/intern/frame_accessor.cc +++ b/intern/libmv/intern/frame_accessor.cc @@ -45,6 +45,9 @@ struct LibmvFrameAccessor : public FrameAccessor { get_image_callback_(get_image_callback), release_image_callback_(release_image_callback) { } + virtual ~LibmvFrameAccessor() { + } + libmv_InputMode get_libmv_input_mode(InputMode input_mode) { switch (input_mode) { #define CHECK_INPUT_MODE(mode) \ diff --git a/intern/opensubdiv/opensubdiv_evaluator_capi.cc b/intern/opensubdiv/opensubdiv_evaluator_capi.cc index 0da6b9daba8..c4a128213dd 100644 --- a/intern/opensubdiv/opensubdiv_evaluator_capi.cc +++ b/intern/opensubdiv/opensubdiv_evaluator_capi.cc @@ -117,12 +117,12 @@ protected: * is small enough and better to be allocated in stack rather * than in heap. * - * TODO(sergey): Check if bare arrays could be sued by CPU evalautor. + * TODO(sergey): Check if bare arrays could be used by CPU evalautor. */ template <int element_size, int num_verts> class StackAllocatedBuffer { public: - static PatchCoordBuffer *Create(int size) + static PatchCoordBuffer *Create(int /*size*/) { StackAllocatedBuffer<element_size, num_verts> *buffer = new StackAllocatedBuffer<element_size, num_verts>(); diff --git a/source/blender/blenkernel/BKE_effect.h b/source/blender/blenkernel/BKE_effect.h index 90fe3601372..0645bc1e00e 100644 --- a/source/blender/blenkernel/BKE_effect.h +++ b/source/blender/blenkernel/BKE_effect.h @@ -166,6 +166,7 @@ typedef struct SimDebugElement { float color[3]; float v1[3], v2[3]; + char str[64]; } SimDebugElement; typedef enum eSimDebugElement_Type { @@ -173,6 +174,7 @@ typedef enum eSimDebugElement_Type { SIM_DEBUG_ELEM_CIRCLE, SIM_DEBUG_ELEM_LINE, SIM_DEBUG_ELEM_VECTOR, + SIM_DEBUG_ELEM_STRING, } eSimDebugElement_Type; typedef struct SimDebugData { @@ -185,26 +187,30 @@ void BKE_sim_debug_data_set_enabled(bool enable); bool BKE_sim_debug_data_get_enabled(void); void BKE_sim_debug_data_free(void); -void BKE_sim_debug_data_add_element(int type, const float v1[3], const float v2[3], +void BKE_sim_debug_data_add_element(int type, const float v1[3], const float v2[3], const char *str, float r, float g, float b, const char *category, unsigned int hash); void BKE_sim_debug_data_remove_element(unsigned int hash); #define BKE_sim_debug_data_add_dot(p, r, g, b, category, ...) { \ const float v2[3] = { 0.0f, 0.0f, 0.0f }; \ - BKE_sim_debug_data_add_element(SIM_DEBUG_ELEM_DOT, p, v2, r, g, b, category, SIM_DEBUG_HASH(__VA_ARGS__)); \ + BKE_sim_debug_data_add_element(SIM_DEBUG_ELEM_DOT, p, v2, NULL, r, g, b, category, SIM_DEBUG_HASH(__VA_ARGS__)); \ } #define BKE_sim_debug_data_add_circle(p, radius, r, g, b, category, ...) { \ const float v2[3] = { radius, 0.0f, 0.0f }; \ - BKE_sim_debug_data_add_element(SIM_DEBUG_ELEM_CIRCLE, p, v2, r, g, b, category, SIM_DEBUG_HASH(__VA_ARGS__)); \ + BKE_sim_debug_data_add_element(SIM_DEBUG_ELEM_CIRCLE, p, v2, NULL, r, g, b, category, SIM_DEBUG_HASH(__VA_ARGS__)); \ } #define BKE_sim_debug_data_add_line(p1, p2, r, g, b, category, ...) { \ - BKE_sim_debug_data_add_element(SIM_DEBUG_ELEM_LINE, p1, p2, r, g, b, category, SIM_DEBUG_HASH(__VA_ARGS__)); \ + BKE_sim_debug_data_add_element(SIM_DEBUG_ELEM_LINE, p1, p2, NULL, r, g, b, category, SIM_DEBUG_HASH(__VA_ARGS__)); \ } #define BKE_sim_debug_data_add_vector(p, d, r, g, b, category, ...) { \ - BKE_sim_debug_data_add_element(SIM_DEBUG_ELEM_VECTOR, p, d, r, g, b, category, SIM_DEBUG_HASH(__VA_ARGS__)); \ + BKE_sim_debug_data_add_element(SIM_DEBUG_ELEM_VECTOR, p, d, NULL, r, g, b, category, SIM_DEBUG_HASH(__VA_ARGS__)); \ +} + +#define BKE_sim_debug_data_add_string(p, str, r, g, b, category, ...) { \ + BKE_sim_debug_data_add_element(SIM_DEBUG_ELEM_STRING, p, NULL, str, r, g, b, category, SIM_DEBUG_HASH(__VA_ARGS__)); \ } #define BKE_sim_debug_data_remove(...) \ diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h index ab8b83f8271..3378f4acc60 100644 --- a/source/blender/blenkernel/BKE_gpencil.h +++ b/source/blender/blenkernel/BKE_gpencil.h @@ -104,7 +104,7 @@ void BKE_gpencil_layer_delete(struct bGPdata *gpd, struct bGPDlayer *gpl); struct bGPDbrush *BKE_gpencil_brush_getactive(struct ToolSettings *ts); void BKE_gpencil_brush_setactive(struct ToolSettings *ts, struct bGPDbrush *active); -void BKE_gpencil_brush_delete(struct ToolSettings *ts, struct bGPDbrush *palette); +void BKE_gpencil_brush_delete(struct ToolSettings *ts, struct bGPDbrush *brush); struct bGPDpalette *BKE_gpencil_palette_getactive(struct bGPdata *gpd); void BKE_gpencil_palette_setactive(struct bGPdata *gpd, struct bGPDpalette *active); diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 95d78436cb9..33125ceeb02 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -991,7 +991,7 @@ static void debug_data_insert(SimDebugData *debug_data, SimDebugElement *elem) BLI_ghash_insert(debug_data->gh, elem, elem); } -void BKE_sim_debug_data_add_element(int type, const float v1[3], const float v2[3], float r, float g, float b, const char *category, unsigned int hash) +void BKE_sim_debug_data_add_element(int type, const float v1[3], const float v2[3], const char *str, float r, float g, float b, const char *category, unsigned int hash) { unsigned int category_hash = BLI_ghashutil_strhash_p(category); SimDebugElement *elem; @@ -1010,8 +1010,18 @@ void BKE_sim_debug_data_add_element(int type, const float v1[3], const float v2[ elem->color[0] = r; elem->color[1] = g; elem->color[2] = b; - copy_v3_v3(elem->v1, v1); - copy_v3_v3(elem->v2, v2); + if (v1) + copy_v3_v3(elem->v1, v1); + else + zero_v3(elem->v1); + if (v2) + copy_v3_v3(elem->v2, v2); + else + zero_v3(elem->v2); + if (str) + BLI_strncpy(elem->str, str, sizeof(elem->str)); + else + elem->str[0] = '\0'; debug_data_insert(_sim_debug_data, elem); } diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 81ab9405856..69fc85b63af 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -529,6 +529,8 @@ void blo_split_main(ListBase *mainlist, Main *main) for (Library *lib = main->library.first; lib; lib = lib->id.next, i++) { Main *libmain = BKE_main_new(); libmain->curlib = lib; + libmain->versionfile = lib->versionfile; + libmain->subversionfile = lib->subversionfile; BLI_addtail(mainlist, libmain); lib->temp_index = i; lib_main_array[i] = libmain; @@ -560,6 +562,10 @@ static void read_file_version(FileData *fd, Main *main) break; } } + if (main->curlib) { + main->curlib->versionfile = main->versionfile; + main->curlib->subversionfile = main->subversionfile; + } } #ifdef USE_GHASH_BHEAD @@ -7718,7 +7724,10 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, const short if (bhead->code == ID_ID) { return blo_nextbhead(fd, bhead); } - + + /* That way, we know which datablock needs do_versions (required currently for linking). */ + id->tag |= LIB_TAG_NEW; + /* need a name for the mallocN, just for debugging and sane prints on leaks */ allocname = dataname(GS(id->name)); @@ -7973,14 +7982,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* don't forget to set version number in BKE_blender_version.h! */ } -#if 0 // XXX: disabled for now... we still don't have this in the right place in the loading code for it to work -static void do_versions_after_linking(FileData *fd, Library *lib, Main *main) +static void do_versions_after_linking(Main *main) { - /* old Animation System (using IPO's) needs to be converted to the new Animato system */ - if (main->versionfile < 250) - do_versions_ipos_to_animato(main); +// printf("%s for %s (%s), %d.%d\n", __func__, main->curlib ? main->curlib->name : main->name, +// main->curlib ? "LIB" : "MAIN", main->versionfile, main->subversionfile); } -#endif static void lib_link_all(FileData *fd, Main *main) { @@ -8180,7 +8186,20 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath) blo_join_main(&mainlist); lib_link_all(fd, bfd->main); - //do_versions_after_linking(fd, NULL, bfd->main); // XXX: not here (or even in this function at all)! this causes crashes on many files - Aligorith (July 04, 2010) + + /* Skip in undo case. */ + if (fd->memfile == NULL) { + /* Yep, second splitting... but this is a very cheap operation, so no big deal. */ + blo_split_main(&mainlist, bfd->main); + for (Main *mainvar = mainlist.first; mainvar; mainvar = mainvar->next) { + BLI_assert(mainvar->versionfile != 0); + do_versions_after_linking(mainvar); + } + blo_join_main(&mainlist); + } + + BKE_main_id_tag_all(bfd->main, LIB_TAG_NEW, false); + lib_verify_nodetree(bfd->main, true); fix_relpaths_library(fd->relabase, bfd->main); /* make all relative paths, relative to the open blend file */ @@ -9653,6 +9672,32 @@ Main *BLO_library_link_begin(Main *mainvar, BlendHandle **bh, const char *filepa return library_link_begin(mainvar, &fd, filepath); } +static void split_main_newid(Main *mainptr, Main *main_newid) +{ + /* We only copy the necessary subset of data in this temp main. */ + main_newid->versionfile = mainptr->versionfile; + main_newid->subversionfile = mainptr->subversionfile; + BLI_strncpy(main_newid->name, mainptr->name, sizeof(main_newid->name)); + main_newid->curlib = mainptr->curlib; + + ListBase *lbarray[MAX_LIBARRAY]; + ListBase *lbarray_newid[MAX_LIBARRAY]; + int i = set_listbasepointers(mainptr, lbarray); + set_listbasepointers(main_newid, lbarray_newid); + while (i--) { + BLI_listbase_clear(lbarray_newid[i]); + + for (ID *id = lbarray[i]->first, *idnext; id; id = idnext) { + idnext = id->next; + + if (id->tag & LIB_TAG_NEW) { + BLI_remlink(lbarray[i], id); + BLI_addtail(lbarray_newid[i], id); + } + } + } +} + /* scene and v3d may be NULL. */ static void library_link_end(Main *mainl, FileData **fd, const short flag, Scene *scene, View3D *v3d) { @@ -9681,10 +9726,28 @@ static void library_link_end(Main *mainl, FileData **fd, const short flag, Scene blo_join_main((*fd)->mainlist); mainvar = (*fd)->mainlist->first; - MEM_freeN((*fd)->mainlist); mainl = NULL; /* blo_join_main free's mainl, cant use anymore */ lib_link_all(*fd, mainvar); + + /* Yep, second splitting... but this is a very cheap operation, so no big deal. */ + blo_split_main((*fd)->mainlist, mainvar); + Main main_newid = {0}; + for (mainvar = ((Main *)(*fd)->mainlist->first)->next; mainvar; mainvar = mainvar->next) { + BLI_assert(mainvar->versionfile != 0); + /* We need to split out IDs already existing, or they will go again through do_versions - bad, very bad! */ + split_main_newid(mainvar, &main_newid); + + do_versions_after_linking(&main_newid); + + add_main_to_main(mainvar, &main_newid); + } + blo_join_main((*fd)->mainlist); + mainvar = (*fd)->mainlist->first; + MEM_freeN((*fd)->mainlist); + + BKE_main_id_tag_all(mainvar, LIB_TAG_NEW, false); + lib_verify_nodetree(mainvar, false); fix_relpaths_library(G.main->name, mainvar); /* make all relative paths, relative to the open blend file */ @@ -9924,14 +9987,19 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) } /* do versions, link, and free */ + Main main_newid = {0}; for (mainptr = mainl->next; mainptr; mainptr = mainptr->next) { - /* some mains still have to be read, then - * versionfile is still zero! */ + /* some mains still have to be read, then versionfile is still zero! */ if (mainptr->versionfile) { + /* We need to split out IDs already existing, or they will go again through do_versions - bad, very bad! */ + split_main_newid(mainptr, &main_newid); + if (mainptr->curlib->filedata) // can be zero... with shift+f1 append - do_versions(mainptr->curlib->filedata, mainptr->curlib, mainptr); + do_versions(mainptr->curlib->filedata, mainptr->curlib, &main_newid); else - do_versions(basefd, NULL, mainptr); + do_versions(basefd, NULL, &main_newid); + + add_main_to_main(mainptr, &main_newid); } if (mainptr->curlib->filedata) diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index f5da7d57010..6a1c0e7e4bf 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1475,7 +1475,10 @@ static int image_match_len_exec(bContext *C, wmOperator *UNUSED(op)) if (!ima || !iuser || !BKE_image_has_anim(ima)) return OPERATOR_CANCELLED; - iuser->frames = IMB_anim_get_duration(((ImageAnim *) ima->anims.first)->anim, IMB_TC_RECORD_RUN); + struct ImageAnim *anim = ((ImageAnim *)ima->anims.first)->anim; + if (!anim) + return OPERATOR_CANCELLED; + iuser->frames = IMB_anim_get_duration(anim, IMB_TC_RECORD_RUN); BKE_image_user_frame_calc(iuser, scene->r.cfra, 0); return OPERATOR_FINISHED; diff --git a/source/blender/editors/space_view3d/drawsimdebug.c b/source/blender/editors/space_view3d/drawsimdebug.c index 286e5825658..2baa6304cd9 100644 --- a/source/blender/editors/space_view3d/drawsimdebug.c +++ b/source/blender/editors/space_view3d/drawsimdebug.c @@ -172,9 +172,23 @@ static void draw_sim_debug_elements(SimDebugData *debug_data, float imat[4][4]) immEnd(); immUnbindProgram(); + + /**** strings ****/ + + for (BLI_ghashIterator_init(&iter, debug_data->gh); !BLI_ghashIterator_done(&iter); BLI_ghashIterator_step(&iter)) { + SimDebugElement *elem = BLI_ghashIterator_getValue(&iter); + if (elem->type != SIM_DEBUG_ELEM_STRING) + continue; + + unsigned char col[4]; + rgb_float_to_uchar(col, elem->color); + col[3] = 255; + view3d_cached_text_draw_add(elem->v1, elem->str, strlen(elem->str), + 0, V3D_CACHE_TEXT_GLOBALSPACE, col); + } } -void draw_sim_debug_data(Scene *UNUSED(scene), View3D *UNUSED(v3d), ARegion *ar) +void draw_sim_debug_data(Scene *UNUSED(scene), View3D *v3d, ARegion *ar) { RegionView3D *rv3d = ar->regiondata; /*Object *ob = base->object;*/ @@ -186,9 +200,11 @@ void draw_sim_debug_data(Scene *UNUSED(scene), View3D *UNUSED(v3d), ARegion *ar) invert_m4_m4(imat, rv3d->viewmatob); glPushMatrix(); - glLoadMatrixf(rv3d->viewmat); + + view3d_cached_text_draw_begin(); draw_sim_debug_elements(_sim_debug_data, imat); + view3d_cached_text_draw_end(v3d, ar, false, NULL); glPopMatrix(); } diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index 91b8c605996..f5c714a7629 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -155,8 +155,9 @@ typedef struct Library { struct PackedFile *packedfile; + /* Temp data needed by read/write code. */ int temp_index; - int _pad; + short versionfile, subversionfile; /* see BLENDER_VERSION, BLENDER_SUBVERSION, needed for do_versions */ } Library; enum eIconSizes { @@ -335,7 +336,8 @@ enum { /* tag datablock has having actually increased usercount for the extra virtual user. */ LIB_TAG_EXTRAUSER_SET = 1 << 7, - /* RESET_AFTER_USE tag newly duplicated/copied IDs. */ + /* RESET_AFTER_USE tag newly duplicated/copied IDs. + * Also used internally in readfile.c to mark datablocks needing do_versions. */ LIB_TAG_NEW = 1 << 8, /* RESET_BEFORE_USE free test flag. * TODO make it a RESET_AFTER_USE too. */ diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index a44f53342bd..d9c5865b219 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -3763,7 +3763,7 @@ static const char *cpp_classes = "" "\n" "private:\n" " const CollectionIterator<T, Tbegin, Tnext, Tend>& operator = " -"(const CollectionIterator<T, Tbegin, Tnext, Tend>& copy) {}\n" +"(const CollectionIterator<T, Tbegin, Tnext, Tend>& /*copy*/) {}\n" "" " CollectionPropertyIterator iter;\n" " T t;\n" diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c index 6b885f6d8dd..fa111144970 100644 --- a/source/blenderplayer/bad_level_call_stubs/stubs.c +++ b/source/blenderplayer/bad_level_call_stubs/stubs.c @@ -670,7 +670,7 @@ void RE_point_density_sample(struct Scene *scene, struct PointDensity *pd, int r void RE_point_density_free(struct PointDensity *pd) RET_NONE; void RE_instance_get_particle_info(struct ObjectInstanceRen *obi, float *index, float *age, float *lifetime, float co[3], float *size, float vel[3], float angvel[3]) RET_NONE void RE_FreeAllPersistentData(void) RET_NONE -float RE_fresnel_dielectric(float incoming[3], float normal[3], float eta) RET_NONE +float RE_fresnel_dielectric(float incoming[3], float normal[3], float eta) RET_ZERO /* python */ struct wmOperatorType *WM_operatortype_find(const char *idname, bool quiet) RET_NULL diff --git a/source/creator/creator_args.c b/source/creator/creator_args.c index 4d05c3f41fb..06119b35e37 100644 --- a/source/creator/creator_args.c +++ b/source/creator/creator_args.c @@ -1886,7 +1886,7 @@ void main_args_setup(bContext *C, bArgs *ba, SYS_SystemHandle *syshandle) BLI_argsAdd(ba, 4, "-E", "--engine", CB(arg_handle_engine_set), C); BLI_argsAdd(ba, 4, "-F", "--render-format", CB(arg_handle_image_type_set), C); - BLI_argsAdd(ba, 4, "-t", "--threads", CB(arg_handle_threads_set), NULL); + BLI_argsAdd(ba, 1, "-t", "--threads", CB(arg_handle_threads_set), NULL); BLI_argsAdd(ba, 4, "-x", "--use-extension", CB(arg_handle_extension_set), C); #undef CB |