diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2017-01-26 21:17:22 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2017-01-26 21:17:22 +0300 |
commit | c1742b88a4cf58e474b3dfe9d01921105b8c8b6e (patch) | |
tree | 1147fc9d41c9200f9f591d6dd26720af4f1225b3 | |
parent | 8f673cb40c6d038ecaabd24c6549dc5c7571c26a (diff) | |
parent | 8d04f49d0ea53552500e82afea92addaaa939dfd (diff) |
Merge remote-tracking branch 'origin/blender2.8' into render-layers
Note:
renamed blo_do_versions_after_linking_280 to do_versions_after_linking_280 to following the pattern of do_versions_after_linking_270
50 files changed, 403 insertions, 268 deletions
diff --git a/build_files/cmake/Modules/GTestTesting.cmake b/build_files/cmake/Modules/GTestTesting.cmake index 96c06ef8eb5..0732e10133c 100644 --- a/build_files/cmake/Modules/GTestTesting.cmake +++ b/build_files/cmake/Modules/GTestTesting.cmake @@ -45,7 +45,7 @@ macro(BLENDER_SRC_GTEST_EX NAME SRC EXTRA_LIBS DO_ADD_TEST) RUNTIME_OUTPUT_DIRECTORY_DEBUG "${TESTS_OUTPUT_DIR}" INCLUDE_DIRECTORIES "${TEST_INC}") if(${DO_ADD_TEST}) - add_test(${NAME}_test ${TESTS_OUTPUT_DIR}/${NAME}_test) + add_test(NAME ${NAME}_test COMMAND ${TESTS_OUTPUT_DIR}/${NAME}_test WORKING_DIRECTORY $<TARGET_FILE_DIR:blender>) endif() endif() endmacro() diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index 2e3a1907063..09428953a46 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -416,14 +416,7 @@ function(setup_liblinks target_link_libraries(${target} ${OPENCOLORIO_LIBRARIES}) endif() if(WITH_OPENSUBDIV OR WITH_CYCLES_OPENSUBDIV) - if(WIN32 AND NOT UNIX) - file_list_suffix(OPENSUBDIV_LIBRARIES_DEBUG "${OPENSUBDIV_LIBRARIES}" "_d") - target_link_libraries_debug(${target} "${OPENSUBDIV_LIBRARIES_DEBUG}") - target_link_libraries_optimized(${target} "${OPENSUBDIV_LIBRARIES}") - unset(OPENSUBDIV_LIBRARIES_DEBUG) - else() target_link_libraries(${target} ${OPENSUBDIV_LIBRARIES}) - endif() endif() if(WITH_OPENVDB) target_link_libraries(${target} ${OPENVDB_LIBRARIES} ${TBB_LIBRARIES}) diff --git a/build_files/cmake/platform/platform_win32_msvc.cmake b/build_files/cmake/platform/platform_win32_msvc.cmake index 3b50351a131..1a266df7791 100644 --- a/build_files/cmake/platform/platform_win32_msvc.cmake +++ b/build_files/cmake/platform/platform_win32_msvc.cmake @@ -446,10 +446,14 @@ if(WITH_MOD_CLOTH_ELTOPO) endif() if(WITH_OPENSUBDIV OR WITH_CYCLES_OPENSUBDIV) - set(OPENSUBDIV_INCLUDE_DIR ${LIBDIR}/opensubdiv/include) - set(OPENSUBDIV_LIBPATH ${LIBDIR}/opensubdiv/lib) - set(OPENSUBDIV_LIBRARIES ${OPENSUBDIV_LIBPATH}/osdCPU.lib ${OPENSUBDIV_LIBPATH}/osdGPU.lib) - find_package(OpenSubdiv) + set(OPENSUBDIV_INCLUDE_DIR ${LIBDIR}/opensubdiv/include) + set(OPENSUBDIV_LIBPATH ${LIBDIR}/opensubdiv/lib) + set(OPENSUBDIV_LIBRARIES optimized ${OPENSUBDIV_LIBPATH}/osdCPU.lib + optimized ${OPENSUBDIV_LIBPATH}/osdGPU.lib + debug ${OPENSUBDIV_LIBPATH}/osdCPU_d.lib + debug ${OPENSUBDIV_LIBPATH}/osdGPU_d.lib + ) + windows_find_package(OpenSubdiv) endif() if(WITH_SDL) diff --git a/intern/cycles/blender/blender_mesh.cpp b/intern/cycles/blender/blender_mesh.cpp index 66893d4d668..85117cfff7b 100644 --- a/intern/cycles/blender/blender_mesh.cpp +++ b/intern/cycles/blender/blender_mesh.cpp @@ -927,6 +927,13 @@ Mesh *BlenderSync::sync_mesh(BL::Object& b_ob, mesh->subdivision_type = object_subdivision_type(b_ob, preview, experimental); + /* Disable adaptive subdivision while baking as the baking system + * currently doesnt support the topology and will crash. + */ + if(scene->bake_manager->get_baking()) { + mesh->subdivision_type = Mesh::SUBDIVISION_NONE; + } + BL::Mesh b_mesh = object_to_mesh(b_data, b_ob, b_scene, diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp index f63f94ab37a..f6ec015e1b8 100644 --- a/intern/cycles/blender/blender_shader.cpp +++ b/intern/cycles/blender/blender_shader.cpp @@ -640,7 +640,8 @@ static ShaderNode *add_node(Scene *scene, image->filename.string(), image->builtin_data, get_image_interpolation(b_image_node), - get_image_extension(b_image_node)); + get_image_extension(b_image_node), + image->use_alpha); } } image->color_space = (NodeImageColorSpace)b_image_node.color_space(); @@ -686,7 +687,8 @@ static ShaderNode *add_node(Scene *scene, env->filename.string(), env->builtin_data, get_image_interpolation(b_env_node), - EXTENSION_REPEAT); + EXTENSION_REPEAT, + env->use_alpha); } } env->color_space = (NodeImageColorSpace)b_env_node.color_space(); @@ -823,7 +825,8 @@ static ShaderNode *add_node(Scene *scene, point_density->filename.string(), point_density->builtin_data, point_density->interpolation, - EXTENSION_CLIP); + EXTENSION_CLIP, + true); } node = point_density; diff --git a/intern/cycles/bvh/bvh_build.cpp b/intern/cycles/bvh/bvh_build.cpp index 1ce3a754460..a2f8b33cb0b 100644 --- a/intern/cycles/bvh/bvh_build.cpp +++ b/intern/cycles/bvh/bvh_build.cpp @@ -26,6 +26,7 @@ #include "scene.h" #include "curves.h" +#include "util_algorithm.h" #include "util_debug.h" #include "util_foreach.h" #include "util_logging.h" diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp index ab830b19c57..fd8a1262208 100644 --- a/intern/cycles/render/image.cpp +++ b/intern/cycles/render/image.cpp @@ -258,12 +258,14 @@ static bool image_equals(ImageManager::Image *image, const string& filename, void *builtin_data, InterpolationType interpolation, - ExtensionType extension) + ExtensionType extension, + bool use_alpha) { return image->filename == filename && image->builtin_data == builtin_data && image->interpolation == interpolation && - image->extension == extension; + image->extension == extension && + image->use_alpha == use_alpha; } int ImageManager::add_image(const string& filename, @@ -305,7 +307,8 @@ int ImageManager::add_image(const string& filename, filename, builtin_data, interpolation, - extension)) + extension, + use_alpha)) { if(img->frame != frame) { img->frame = frame; @@ -377,7 +380,8 @@ void ImageManager::remove_image(int flat_slot) void ImageManager::remove_image(const string& filename, void *builtin_data, InterpolationType interpolation, - ExtensionType extension) + ExtensionType extension, + bool use_alpha) { size_t slot; @@ -387,7 +391,8 @@ void ImageManager::remove_image(const string& filename, filename, builtin_data, interpolation, - extension)) + extension, + use_alpha)) { remove_image(type_index_to_flattened_slot(slot, (ImageDataType)type)); return; @@ -403,7 +408,8 @@ void ImageManager::remove_image(const string& filename, void ImageManager::tag_reload_image(const string& filename, void *builtin_data, InterpolationType interpolation, - ExtensionType extension) + ExtensionType extension, + bool use_alpha) { for(size_t type = 0; type < IMAGE_DATA_NUM_TYPES; type++) { for(size_t slot = 0; slot < images[type].size(); slot++) { @@ -411,7 +417,8 @@ void ImageManager::tag_reload_image(const string& filename, filename, builtin_data, interpolation, - extension)) + extension, + use_alpha)) { images[type][slot]->need_load = true; break; diff --git a/intern/cycles/render/image.h b/intern/cycles/render/image.h index 47bbd92347c..494c74f0cdd 100644 --- a/intern/cycles/render/image.h +++ b/intern/cycles/render/image.h @@ -61,11 +61,13 @@ public: void remove_image(const string& filename, void *builtin_data, InterpolationType interpolation, - ExtensionType extension); + ExtensionType extension, + bool use_alpha); void tag_reload_image(const string& filename, void *builtin_data, InterpolationType interpolation, - ExtensionType extension); + ExtensionType extension, + bool use_alpha); ImageDataType get_image_metadata(const string& filename, void *builtin_data, bool& is_linear); void device_update(Device *device, diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp index 1e4a9fd300c..13b149eddfa 100644 --- a/intern/cycles/render/nodes.cpp +++ b/intern/cycles/render/nodes.cpp @@ -263,7 +263,8 @@ ImageTextureNode::~ImageTextureNode() image_manager->remove_image(filename.string(), builtin_data, interpolation, - extension); + extension, + use_alpha); } } @@ -462,7 +463,8 @@ EnvironmentTextureNode::~EnvironmentTextureNode() image_manager->remove_image(filename.string(), builtin_data, interpolation, - EXTENSION_REPEAT); + EXTENSION_REPEAT, + use_alpha); } } @@ -1381,7 +1383,8 @@ PointDensityTextureNode::~PointDensityTextureNode() image_manager->remove_image(filename.string(), builtin_data, interpolation, - EXTENSION_CLIP); + EXTENSION_CLIP, + true); } } diff --git a/intern/cycles/render/tile.cpp b/intern/cycles/render/tile.cpp index e59d0c843a3..a493c3fa1cd 100644 --- a/intern/cycles/render/tile.cpp +++ b/intern/cycles/render/tile.cpp @@ -157,7 +157,7 @@ void TileManager::set_samples(int num_samples_) divider >>= 1; } - state.total_pixel_samples = pixel_samples + get_num_effective_samples() * params.width*params.height; + state.total_pixel_samples = pixel_samples + (uint64_t)get_num_effective_samples() * params.width*params.height; } } diff --git a/intern/cycles/test/CMakeLists.txt b/intern/cycles/test/CMakeLists.txt index 9af777fb9dd..80564c33be6 100644 --- a/intern/cycles/test/CMakeLists.txt +++ b/intern/cycles/test/CMakeLists.txt @@ -54,12 +54,23 @@ if(WITH_CYCLES_OPENSUBDIV) endif() list(APPEND ALL_CYCLES_LIBRARIES ${BOOST_LIBRARIES} + ${PNG_LIBRARIES} + ${JPEG_LIBRARIES} + ${ZLIB_LIBRARIES} + ${TIFF_LIBRARY} + ${OPENIMAGEIO_LIBRARIES} + ${OPENEXR_LIBRARIES} ) include_directories(${INC}) -link_directories(${BOOST_LIBPATH}) -link_directories(${OPENIMAGEIO_LIBPATH}) +link_directories(${OPENIMAGEIO_LIBPATH} + ${BOOST_LIBPATH} + ${PNG_LIBPATH} + ${JPEG_LIBPATH} + ${ZLIB_LIBPATH} + ${TIFF_LIBPATH} + ${OPENEXR_LIBPATH}) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}") set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}") @@ -22,7 +22,7 @@ set MUST_CLEAN= set NOBUILD= set TARGET= set WINDOWS_ARCH= - +set TESTS_CMAKE_ARGS= :argv_loop if NOT "%1" == "" ( @@ -35,6 +35,8 @@ if NOT "%1" == "" ( if "%1" == "debug" ( set BUILD_TYPE=Debug REM Build Configurations + ) else if "%1" == "with_tests" ( + set TESTS_CMAKE_ARGS=-DWITH_GTESTS=On ) else if "%1" == "full" ( set TARGET=Full set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^ @@ -204,7 +206,7 @@ if "%TARGET%"=="" ( goto HELP ) -set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -G "Visual Studio %BUILD_VS_VER% %BUILD_VS_YEAR%%WINDOWS_ARCH%" +set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -G "Visual Studio %BUILD_VS_VER% %BUILD_VS_YEAR%%WINDOWS_ARCH%" %TESTS_CMAKE_ARGS% if NOT EXIST %BUILD_DIR%\nul ( mkdir %BUILD_DIR% ) @@ -284,6 +286,7 @@ goto EOF echo - showhash ^(Show git hashes of source tree^) echo. echo Configuration options + echo - with_tests ^(enable building unit tests^) echo - debug ^(Build an unoptimized debuggable build^) echo - packagename [newname] ^(override default cpack package name^) echo - x86 ^(override host autodetect and build 32 bit code^) diff --git a/release/scripts/startup/bl_ui/space_outliner.py b/release/scripts/startup/bl_ui/space_outliner.py index 708db2eec8d..6f7c535fe21 100644 --- a/release/scripts/startup/bl_ui/space_outliner.py +++ b/release/scripts/startup/bl_ui/space_outliner.py @@ -93,7 +93,8 @@ class OUTLINER_MT_view(Menu): layout.separator() layout.operator("outliner.show_active") - layout.operator("outliner.show_one_level") + layout.operator("outliner.show_one_level", text="Show One Level") + layout.operator("outliner.show_one_level", text="Hide One Level").open = False layout.operator("outliner.show_hierarchy") layout.separator() diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py index 0648db3746d..6bb516cf929 100644 --- a/release/scripts/startup/bl_ui/space_sequencer.py +++ b/release/scripts/startup/bl_ui/space_sequencer.py @@ -435,15 +435,9 @@ class SEQUENCER_MT_strip(Menu): layout.operator("sequencer.crossfade_sounds") layout.separator() - layout.operator("sequencer.meta_make") layout.operator("sequencer.meta_separate") - #if (ed && (ed->metastack.first || (ed->act_seq && ed->act_seq->type == SEQ_META))) { - # uiItemS(layout); - # uiItemO(layout, NULL, 0, "sequencer.meta_toggle"); - #} - layout.separator() layout.operator("sequencer.reload", text="Reload Strips") layout.operator("sequencer.reload", text="Reload Strips and Adjust Length").adjust_length = True diff --git a/source/blender/alembic/CMakeLists.txt b/source/blender/alembic/CMakeLists.txt index ad85f79ef2e..a6e0be6a7f3 100644 --- a/source/blender/alembic/CMakeLists.txt +++ b/source/blender/alembic/CMakeLists.txt @@ -39,14 +39,10 @@ set(INC set(INC_SYS ${ALEMBIC_INCLUDE_DIRS} + ${BOOST_INCLUDE_DIR} ${HDF5_INCLUDE_DIRS} ${OPENEXR_INCLUDE_DIRS} ) -if(APPLE OR WIN32) - list(APPEND INC_SYS - ${BOOST_INCLUDE_DIR} - ) -endif() set(SRC intern/abc_archive.cc diff --git a/source/blender/blenfont/intern/blf_thumbs.c b/source/blender/blenfont/intern/blf_thumbs.c index 133168fccf2..b6f5ffbb092 100644 --- a/source/blender/blenfont/intern/blf_thumbs.c +++ b/source/blender/blenfont/intern/blf_thumbs.c @@ -98,6 +98,10 @@ void BLF_thumb_preview( blf_font_size(font, (unsigned int)MAX2(font_size_min, font_size_curr), dpi); + /* font->glyph_cache remains NULL if blf_font_size() failed to set font size */ + if (!font->glyph_cache) + break; + /* decrease font size each time */ font_size_curr -= (font_size_curr / font_shrink); font_shrink += 1; diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index 784c76bffd3..789bc8df7e5 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -172,8 +172,6 @@ typedef enum DMDirtyFlag { /* check this with modifier dependsOnNormals callback to see if normals need recalculation */ DM_DIRTY_NORMALS = 1 << 2, - - DM_MESH_BATCH_CACHE = 1 << 3, } DMDirtyFlag; typedef struct DerivedMesh DerivedMesh; diff --git a/source/blender/blenkernel/BKE_mesh_render.h b/source/blender/blenkernel/BKE_mesh_render.h index 8a2b3f9d9ec..29787dcfdab 100644 --- a/source/blender/blenkernel/BKE_mesh_render.h +++ b/source/blender/blenkernel/BKE_mesh_render.h @@ -32,6 +32,7 @@ struct Batch; struct Mesh; +void BKE_mesh_batch_cache_dirty(struct Mesh *me); void BKE_mesh_batch_cache_free(struct Mesh *me); struct Batch *BKE_mesh_batch_cache_get_all_edges(struct Mesh *me); struct Batch *BKE_mesh_batch_cache_get_all_triangles(struct Mesh *me); diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index d1e7e2e5e45..e25b71d508e 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -207,6 +207,7 @@ void BKE_object_eval_uber_transform(struct EvaluationContext *eval_ctx, void BKE_object_eval_uber_data(struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob); +void BKE_object_eval_shading(struct EvaluationContext *eval_ctx, struct Object *ob); void BKE_object_handle_data_update(struct EvaluationContext *eval_ctx, struct Scene *scene, diff --git a/source/blender/blenkernel/intern/mesh_render.c b/source/blender/blenkernel/intern/mesh_render.c index f90783a3dbb..4118208d32f 100644 --- a/source/blender/blenkernel/intern/mesh_render.c +++ b/source/blender/blenkernel/intern/mesh_render.c @@ -234,7 +234,8 @@ typedef struct MeshBatchCache { Batch *fancy_edges; /* owns its vertex buffer (not shared) */ Batch *overlay_edges; /* owns its vertex buffer */ - /* TODO: settings, before DEPSGRAPH update */ + /* settings to determine if cache is invalid */ + bool is_dirty; int tot_edges; int tot_faces; int tot_polys; @@ -254,20 +255,20 @@ static bool mesh_batch_cache_valid(Mesh *me) return false; } - if (cache->is_editmode) { - DerivedMesh *dm = me->edit_btmesh->derivedFinal; - if ((dm->dirty & DM_MESH_BATCH_CACHE) == 0) { + if (cache->is_dirty == false) { + return true; + } + else { + if (cache->is_editmode) { + return false; + } + else if ((cache->tot_edges != mesh_render_get_num_edges(me)) || + (cache->tot_faces != mesh_render_get_num_faces(me)) || + (cache->tot_polys != mesh_render_get_num_polys(me)) || + (cache->tot_verts != mesh_render_get_num_verts(me))) + { return false; } - } - - /* TODO: temporary check, waiting for depsgraph update */ - if ((cache->tot_edges != mesh_render_get_num_edges(me)) || - (cache->tot_faces != mesh_render_get_num_faces(me)) || - (cache->tot_polys != mesh_render_get_num_polys(me)) || - (cache->tot_verts != mesh_render_get_num_verts(me))) - { - return false; } return true; @@ -278,15 +279,14 @@ static void mesh_batch_cache_init(Mesh *me) MeshBatchCache *cache = me->batch_cache; cache->is_editmode = me->edit_btmesh != NULL; - cache->tot_edges = mesh_render_get_num_edges(me); - cache->tot_faces = mesh_render_get_num_faces(me); - cache->tot_polys = mesh_render_get_num_polys(me); - cache->tot_verts = mesh_render_get_num_verts(me); - - if (cache->is_editmode) { - DerivedMesh *dm = me->edit_btmesh->derivedFinal; - dm->dirty |= DM_MESH_BATCH_CACHE; + if (cache->is_editmode == false) { + cache->tot_edges = mesh_render_get_num_edges(me); + cache->tot_faces = mesh_render_get_num_faces(me); + cache->tot_polys = mesh_render_get_num_polys(me); + cache->tot_verts = mesh_render_get_num_verts(me); } + + cache->is_dirty = false; } static MeshBatchCache *mesh_batch_cache_get(Mesh *me) @@ -378,6 +378,14 @@ static ElementList *mesh_batch_cache_get_triangles_in_order(Mesh *me) return cache->triangles_in_order; } +void BKE_mesh_batch_cache_dirty(struct Mesh *me) +{ + MeshBatchCache *cache = me->batch_cache; + if (cache) { + cache->is_dirty = true; + } +} + void BKE_mesh_batch_cache_free(Mesh *me) { MeshBatchCache *cache = me->batch_cache; diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c index 047de18d5b5..46e6d09294d 100644 --- a/source/blender/blenkernel/intern/object_update.c +++ b/source/blender/blenkernel/intern/object_update.c @@ -51,6 +51,7 @@ #include "BKE_key.h" #include "BKE_lamp.h" #include "BKE_lattice.h" +#include "BKE_mesh_render.h" #include "BKE_editmesh.h" #include "BKE_object.h" #include "BKE_particle.h" @@ -343,3 +344,11 @@ void BKE_object_eval_uber_data(EvaluationContext *eval_ctx, ob->recalc &= ~(OB_RECALC_DATA | OB_RECALC_TIME); } + +void BKE_object_eval_shading(EvaluationContext *UNUSED(eval_ctx), Object *ob) +{ + DEBUG_PRINT("%s on %s\n", __func__, ob->id.name); + if (ob->type == OB_MESH) { + BKE_mesh_batch_cache_dirty(ob->data); + } +} diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 54eaf29980d..c1316373b2a 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -1583,6 +1583,8 @@ bool BKE_scene_remove_render_layer(Main *bmain, Scene *scene, SceneRenderLayer * return false; } + BKE_freestyle_config_free(&srl->freestyleConfig); + BLI_remlink(&scene->r.layers, srl); MEM_freeN(srl); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index d00e472c2da..cec886b4ce3 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -3245,6 +3245,11 @@ static void direct_link_constraints(FileData *fd, ListBase *lb) con->flag |= CONSTRAINT_SPACEONCE; break; } + case CONSTRAINT_TYPE_TRANSFORM_CACHE: + { + bTransformCacheConstraint *data = con->data; + data->reader = NULL; + } } } } @@ -8464,10 +8469,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main) static void do_versions_after_linking(Main *main) { - UNUSED_VARS(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); - blo_do_versions_after_linking_280(main); + do_versions_after_linking_270(main); + do_versions_after_linking_280(main); } static void lib_link_all(FileData *fd, Main *main) diff --git a/source/blender/blenloader/intern/readfile.h b/source/blender/blenloader/intern/readfile.h index d6203a88d95..50cdeca16b5 100644 --- a/source/blender/blenloader/intern/readfile.h +++ b/source/blender/blenloader/intern/readfile.h @@ -172,7 +172,9 @@ void blo_do_versions_250(struct FileData *fd, struct Library *lib, struct Main * void blo_do_versions_260(struct FileData *fd, struct Library *lib, struct Main *main); void blo_do_versions_270(struct FileData *fd, struct Library *lib, struct Main *main); void blo_do_versions_280(struct FileData *fd, struct Library *lib, struct Main *main); -void blo_do_versions_after_linking_280(struct Main *main); + +void do_versions_after_linking_270(struct Main *main); +void do_versions_after_linking_280(struct Main *main); #endif diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c index 58cc06ddec6..477382d8c5b 100644 --- a/source/blender/blenloader/intern/versioning_270.c +++ b/source/blender/blenloader/intern/versioning_270.c @@ -34,6 +34,7 @@ /* allow readfile to use deprecated functionality */ #define DNA_DEPRECATED_ALLOW +#include "DNA_anim_types.h" #include "DNA_armature_types.h" #include "DNA_brush_types.h" #include "DNA_camera_types.h" @@ -58,6 +59,7 @@ #include "DNA_genfile.h" +#include "BKE_animsys.h" #include "BKE_colortools.h" #include "BKE_library.h" #include "BKE_main.h" @@ -76,6 +78,9 @@ #include "BLO_readfile.h" +#include "NOD_common.h" +#include "NOD_socket.h" + #include "readfile.h" #include "MEM_guardedalloc.h" @@ -195,6 +200,50 @@ static void do_version_bones_super_bbone(ListBase *lb) } } +/* TODO(sergey): Consider making it somewhat more generic function in BLI_anim.h. */ +static void anim_change_prop_name(FCurve *fcu, + const char *prefix, + const char *old_prop_name, + const char *new_prop_name) +{ + const char *old_path = BLI_sprintfN("%s.%s", prefix, old_prop_name); + if (STREQ(fcu->rna_path, old_path)) { + MEM_freeN(fcu->rna_path); + fcu->rna_path = BLI_sprintfN("%s.%s", prefix, new_prop_name); + } + MEM_freeN((char *)old_path); +} + +static void do_version_hue_sat_node(bNodeTree *ntree, bNode *node) +{ + /* Make sure new sockets are properly created. */ + node_verify_socket_templates(ntree, node); + /* Convert value from old storage to new sockets. */ + NodeHueSat *nhs = node->storage; + bNodeSocket *hue = nodeFindSocket(node, SOCK_IN, "Hue"), + *saturation = nodeFindSocket(node, SOCK_IN, "Saturation"), + *value = nodeFindSocket(node, SOCK_IN, "Value"); + ((bNodeSocketValueFloat *)hue->default_value)->value = nhs->hue; + ((bNodeSocketValueFloat *)saturation->default_value)->value = nhs->sat; + ((bNodeSocketValueFloat *)value->default_value)->value = nhs->val; + /* Take care of possible animation. */ + AnimData *adt = BKE_animdata_from_id(&ntree->id); + if (adt != NULL && adt->action != NULL) { + const char *prefix = BLI_sprintfN("nodes[\"%s\"]", node->name); + for (FCurve *fcu = adt->action->curves.first; fcu != NULL; fcu = fcu->next) { + if (STRPREFIX(fcu->rna_path, prefix)) { + anim_change_prop_name(fcu, prefix, "color_hue", "inputs[1].default_value"); + anim_change_prop_name(fcu, prefix, "color_saturation", "inputs[2].default_value"); + anim_change_prop_name(fcu, prefix, "color_value", "inputs[3].default_value"); + } + } + MEM_freeN((char *)prefix); + } + /* Free storage, it is no longer used. */ + MEM_freeN(node->storage); + node->storage = NULL; +} + void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main) { if (!MAIN_VERSION_ATLEAST(main, 270, 0)) { @@ -1521,6 +1570,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main) } } } + } { @@ -1546,3 +1596,20 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main) } } } + +void do_versions_after_linking_270(Main *main) +{ + /* To be added to next subversion bump! */ + { + FOREACH_NODETREE(main, ntree, id) { + if (ntree->type == NTREE_COMPOSIT) { + ntreeSetTypes(NULL, ntree); + for (bNode *node = ntree->nodes.first; node; node = node->next) { + if (node->type == CMP_NODE_HUE_SAT) { + do_version_hue_sat_node(ntree, node); + } + } + } + } FOREACH_NODETREE_END + } +} diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index bd6bb9eebf0..2f3251fb702 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -46,7 +46,7 @@ #include "MEM_guardedalloc.h" -void blo_do_versions_after_linking_280(Main *main) +void do_versions_after_linking_280(Main *main) { if (!MAIN_VERSION_ATLEAST(main, 280, 0)) { for (Scene *scene = main->scene.first; scene; scene = scene->id.next) { diff --git a/source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp b/source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp index 29c296a896d..b8971fffe3e 100644 --- a/source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp +++ b/source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp @@ -37,8 +37,11 @@ HueSaturationValueNode::HueSaturationValueNode(bNode *editorNode) : Node(editorN void HueSaturationValueNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const { - NodeInput *valueSocket = this->getInputSocket(0); - NodeInput *colorSocket = this->getInputSocket(1); + NodeInput *colorSocket = this->getInputSocket(0); + NodeInput *hueSocket = this->getInputSocket(1); + NodeInput *saturationSocket = this->getInputSocket(2); + NodeInput *valueSocket = this->getInputSocket(3); + NodeInput *facSocket = this->getInputSocket(4); NodeOutput *outputSocket = this->getOutputSocket(0); bNode *editorsnode = getbNode(); NodeHueSat *storage = (NodeHueSat *)editorsnode->storage; @@ -50,9 +53,9 @@ void HueSaturationValueNode::convertToOperations(NodeConverter &converter, const converter.addOperation(hsvToRGB); ChangeHSVOperation *changeHSV = new ChangeHSVOperation(); - changeHSV->setHue(storage->hue); - changeHSV->setSaturation(storage->sat); - changeHSV->setValue(storage->val); + converter.mapInputSocket(hueSocket, changeHSV->getInputSocket(1)); + converter.mapInputSocket(saturationSocket, changeHSV->getInputSocket(2)); + converter.mapInputSocket(valueSocket, changeHSV->getInputSocket(3)); converter.addOperation(changeHSV); MixBlendOperation *blend = new MixBlendOperation(); @@ -64,6 +67,6 @@ void HueSaturationValueNode::convertToOperations(NodeConverter &converter, const converter.addLink(changeHSV->getOutputSocket(), hsvToRGB->getInputSocket(0)); converter.addLink(hsvToRGB->getOutputSocket(), blend->getInputSocket(2)); converter.mapInputSocket(colorSocket, blend->getInputSocket(1)); - converter.mapInputSocket(valueSocket, blend->getInputSocket(0)); + converter.mapInputSocket(facSocket, blend->getInputSocket(0)); converter.mapOutputSocket(outputSocket, blend->getOutputSocket()); } diff --git a/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp b/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp index 964f1d64667..7ea974a41dc 100644 --- a/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp +++ b/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp @@ -25,6 +25,9 @@ ChangeHSVOperation::ChangeHSVOperation() : NodeOperation() { this->addInputSocket(COM_DT_COLOR); + this->addInputSocket(COM_DT_VALUE); + this->addInputSocket(COM_DT_VALUE); + this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_COLOR); this->m_inputOperation = NULL; } @@ -32,24 +35,34 @@ ChangeHSVOperation::ChangeHSVOperation() : NodeOperation() void ChangeHSVOperation::initExecution() { this->m_inputOperation = getInputSocketReader(0); + this->m_hueOperation = getInputSocketReader(1); + this->m_saturationOperation = getInputSocketReader(2); + this->m_valueOperation = getInputSocketReader(3); } void ChangeHSVOperation::deinitExecution() { this->m_inputOperation = NULL; + this->m_hueOperation = NULL; + this->m_saturationOperation = NULL; + this->m_valueOperation = NULL; } void ChangeHSVOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler) { float inputColor1[4]; + float hue[4], saturation[4], value[4]; this->m_inputOperation->readSampled(inputColor1, x, y, sampler); + this->m_hueOperation->readSampled(hue, x, y, sampler); + this->m_saturationOperation->readSampled(saturation, x, y, sampler); + this->m_valueOperation->readSampled(value, x, y, sampler); - output[0] = inputColor1[0] + (this->m_hue - 0.5f); + output[0] = inputColor1[0] + (hue[0] - 0.5f); if (output[0] > 1.0f) output[0] -= 1.0f; else if (output[0] < 0.0f) output[0] += 1.0f; - output[1] = inputColor1[1] * this->m_saturation; - output[2] = inputColor1[2] * this->m_value; + output[1] = inputColor1[1] * saturation[0]; + output[2] = inputColor1[2] * value[0]; output[3] = inputColor1[3]; } diff --git a/source/blender/compositor/operations/COM_ChangeHSVOperation.h b/source/blender/compositor/operations/COM_ChangeHSVOperation.h index 76025e86b7a..800c09c05ff 100644 --- a/source/blender/compositor/operations/COM_ChangeHSVOperation.h +++ b/source/blender/compositor/operations/COM_ChangeHSVOperation.h @@ -32,10 +32,9 @@ class ChangeHSVOperation : public NodeOperation { private: SocketReader *m_inputOperation; - - float m_hue; - float m_saturation; - float m_value; + SocketReader *m_hueOperation; + SocketReader *m_saturationOperation; + SocketReader *m_valueOperation; public: /** @@ -51,9 +50,5 @@ public: */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - void setHue(float hue) { this->m_hue = hue; } - void setSaturation(float saturation) { this->m_saturation = saturation; } - void setValue(float value) { this->m_value = value; } - }; #endif diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index e312c4e0dcb..4b73dfa1ec3 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -320,6 +320,23 @@ OperationDepsNode *DepsgraphNodeBuilder::find_operation_node( /* **** Build functions for entity nodes **** */ +void DepsgraphNodeBuilder::begin_build(Main *bmain) { + /* LIB_TAG_DOIT is used to indicate whether node for given ID was already + * created or not. This flag is being set in add_id_node(), so functions + * shouldn't bother with setting it, they only might query this flag when + * needed. + */ + BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false); + /* XXX nested node trees are not included in tag-clearing above, + * so we need to do this manually. + */ + FOREACH_NODETREE(bmain, nodetree, id) { + if (id != (ID *)nodetree) { + nodetree->id.tag &= ~LIB_TAG_DOIT; + } + } FOREACH_NODETREE_END +} + void DepsgraphNodeBuilder::build_group(Scene *scene, Base *base, Group *group) @@ -626,18 +643,18 @@ void DepsgraphNodeBuilder::build_world(World *world) } /* world itself */ - IDDepsNode *world_node = add_id_node(world_id); /* world shading/params? */ + add_id_node(world_id); /* world shading/params? */ build_animdata(world_id); /* TODO: other settings? */ /* textures */ - build_texture_stack(world_node, world->mtex); + build_texture_stack(world->mtex); /* world's nodetree */ if (world->nodetree) { - build_nodetree(world_node, world->nodetree); + build_nodetree(world->nodetree); } } @@ -807,13 +824,18 @@ void DepsgraphNodeBuilder::build_obdata_geom(Scene *scene, Object *ob) } /* materials */ - for (int a = 1; a <= ob->totcol; a++) { - Material *ma = give_current_material(ob, a); - if (ma != NULL) { - // XXX?! - ComponentDepsNode *geom_node = add_component_node(&ob->id, DEPSNODE_TYPE_GEOMETRY); - build_material(geom_node, ma); + if (ob->totcol != 0) { + for (int a = 1; a <= ob->totcol; a++) { + Material *ma = give_current_material(ob, a); + if (ma != NULL) { + build_material(ma); + } } + add_operation_node(&ob->id, + DEPSNODE_TYPE_SHADING, + DEPSOP_TYPE_EXEC, + function_bind(BKE_object_eval_shading, _1, ob), + DEG_OPCODE_OPERATION, "Material Update"); } /* geometry collision */ @@ -976,7 +998,7 @@ void DepsgraphNodeBuilder::build_lamp(Object *ob) build_animdata(&la->id); /* node for obdata */ - ComponentDepsNode *param_node = add_component_node(lamp_id, DEPSNODE_TYPE_PARAMETERS); + add_component_node(lamp_id, DEPSNODE_TYPE_PARAMETERS); /* TODO(sergey): Is it really how we're supposed to work with drivers? */ add_operation_node(lamp_id, DEPSNODE_TYPE_PARAMETERS, DEPSOP_TYPE_EXEC, NULL, @@ -984,14 +1006,14 @@ void DepsgraphNodeBuilder::build_lamp(Object *ob) /* lamp's nodetree */ if (la->nodetree) { - build_nodetree(param_node, la->nodetree); + build_nodetree(la->nodetree); } /* textures */ - build_texture_stack(param_node, la->mtex); + build_texture_stack(la->mtex); } -void DepsgraphNodeBuilder::build_nodetree(DepsNode *owner_node, bNodeTree *ntree) +void DepsgraphNodeBuilder::build_nodetree(bNodeTree *ntree) { if (!ntree) return; @@ -1011,10 +1033,10 @@ void DepsgraphNodeBuilder::build_nodetree(DepsNode *owner_node, bNodeTree *ntree if (id != NULL) { short id_type = GS(id->name); if (id_type == ID_MA) { - build_material(owner_node, (Material *)id); + build_material((Material *)id); } else if (id_type == ID_TE) { - build_texture(owner_node, (Tex *)id); + build_texture((Tex *)id); } else if (id_type == ID_IM) { build_image((Image *)id); @@ -1022,7 +1044,7 @@ void DepsgraphNodeBuilder::build_nodetree(DepsNode *owner_node, bNodeTree *ntree else if (bnode->type == NODE_GROUP) { bNodeTree *group_ntree = (bNodeTree *)id; if ((group_ntree->id.tag & LIB_TAG_DOIT) == 0) { - build_nodetree(owner_node, group_ntree); + build_nodetree(group_ntree); } } } @@ -1032,7 +1054,7 @@ void DepsgraphNodeBuilder::build_nodetree(DepsNode *owner_node, bNodeTree *ntree } /* Recursively build graph for material */ -void DepsgraphNodeBuilder::build_material(DepsNode *owner_node, Material *ma) +void DepsgraphNodeBuilder::build_material(Material *ma) { ID *ma_id = &ma->id; if (ma_id->tag & LIB_TAG_DOIT) { @@ -1050,14 +1072,14 @@ void DepsgraphNodeBuilder::build_material(DepsNode *owner_node, Material *ma) build_animdata(ma_id); /* textures */ - build_texture_stack(owner_node, ma->mtex); + build_texture_stack(ma->mtex); /* material's nodetree */ - build_nodetree(owner_node, ma->nodetree); + build_nodetree(ma->nodetree); } /* Texture-stack attached to some shading datablock */ -void DepsgraphNodeBuilder::build_texture_stack(DepsNode *owner_node, MTex **texture_stack) +void DepsgraphNodeBuilder::build_texture_stack(MTex **texture_stack) { int i; @@ -1065,12 +1087,12 @@ void DepsgraphNodeBuilder::build_texture_stack(DepsNode *owner_node, MTex **text for (i = 0; i < MAX_MTEX; i++) { MTex *mtex = texture_stack[i]; if (mtex && mtex->tex) - build_texture(owner_node, mtex->tex); + build_texture(mtex->tex); } } /* Recursively build graph for texture */ -void DepsgraphNodeBuilder::build_texture(DepsNode *owner_node, Tex *tex) +void DepsgraphNodeBuilder::build_texture(Tex *tex) { ID *tex_id = &tex->id; if (tex_id->tag & LIB_TAG_DOIT) { @@ -1080,7 +1102,7 @@ void DepsgraphNodeBuilder::build_texture(DepsNode *owner_node, Tex *tex) /* Texture itself. */ build_animdata(tex_id); /* Texture's nodetree. */ - build_nodetree(owner_node, tex->nodetree); + build_nodetree(tex->nodetree); /* Special cases for different IDs which texture uses. */ if (tex->type == TEX_IMAGE) { if (tex->ima != NULL) { @@ -1114,8 +1136,8 @@ void DepsgraphNodeBuilder::build_compositor(Scene *scene) //graph->get_node(&scene->id, NULL, DEPSNODE_TYPE_COMPOSITING, NULL); /* for now, nodetrees are just parameters; compositing occurs in internals of renderer... */ - ComponentDepsNode *owner_node = add_component_node(&scene->id, DEPSNODE_TYPE_PARAMETERS); - build_nodetree(owner_node, scene->nodetree); + add_component_node(&scene->id, DEPSNODE_TYPE_PARAMETERS); + build_nodetree(scene->nodetree); } void DepsgraphNodeBuilder::build_gpencil(bGPdata *gpd) diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h index 9cb8bc5d45c..c5035f35f6e 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h @@ -72,6 +72,8 @@ struct DepsgraphNodeBuilder { DepsgraphNodeBuilder(Main *bmain, Depsgraph *graph); ~DepsgraphNodeBuilder(); + void begin_build(Main *bmain); + RootDepsNode *add_root_node(); IDDepsNode *add_id_node(ID *id); TimeSourceDepsNode *add_time_source(ID *id); @@ -147,10 +149,10 @@ struct DepsgraphNodeBuilder { void build_obdata_geom(Scene *scene, Object *ob); void build_camera(Object *ob); void build_lamp(Object *ob); - void build_nodetree(DepsNode *owner_node, bNodeTree *ntree); - void build_material(DepsNode *owner_node, Material *ma); - void build_texture(DepsNode *owner_node, Tex *tex); - void build_texture_stack(DepsNode *owner_node, MTex **texture_stack); + void build_nodetree(bNodeTree *ntree); + void build_material(Material *ma); + void build_texture(Tex *tex); + void build_texture_stack(MTex **texture_stack); void build_image(Image *image); void build_world(World *world); void build_compositor(Scene *scene); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc index c1d51c1ace9..b1896fdc22a 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc @@ -119,7 +119,17 @@ void DepsgraphNodeBuilder::build_rig(Scene *scene, Object *ob) * Eventually, we need some type of proxy/isolation mechanism in-between here * to ensure that we can use same rig multiple times in same scene... */ - build_animdata(&arm->id); + if ((arm->id.tag & LIB_TAG_DOIT) == 0) { + build_animdata(&arm->id); + + /* Make sure pose is up-to-date with armature updates. */ + add_operation_node(&arm->id, + DEPSNODE_TYPE_PARAMETERS, + DEPSOP_TYPE_EXEC, + NULL, + DEG_OPCODE_PLACEHOLDER, + "Armature Eval"); + } /* Rebuild pose if not up to date. */ if (ob->pose == NULL || (ob->pose->flag & POSE_RECALC)) { @@ -141,14 +151,6 @@ void DepsgraphNodeBuilder::build_rig(Scene *scene, Object *ob) } } - /* Make sure pose is up-to-date with armature updates. */ - add_operation_node(&arm->id, - DEPSNODE_TYPE_PARAMETERS, - DEPSOP_TYPE_EXEC, - NULL, - DEG_OPCODE_PLACEHOLDER, - "Armature Eval"); - /** * Pose Rig Graph * ============== diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc index bcd4bc51448..99e61692231 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc @@ -65,20 +65,6 @@ namespace DEG { void DepsgraphNodeBuilder::build_scene(Main *bmain, Scene *scene) { - /* LIB_TAG_DOIT is used to indicate whether node for given ID was already - * created or not. This flag is being set in add_id_node(), so functions - * shouldn't bother with setting it, they only might query this flag when - * needed. - */ - BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false); - /* XXX nested node trees are not included in tag-clearing above, - * so we need to do this manually. - */ - FOREACH_NODETREE(bmain, nodetree, id) { - if (id != (ID *)nodetree) - nodetree->id.tag &= ~LIB_TAG_DOIT; - } FOREACH_NODETREE_END - /* scene ID block */ add_id_node(&scene->id); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index b5272d3acf2..41d2ca0ca6d 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -339,6 +339,22 @@ void DepsgraphRelationBuilder::add_forcefield_relations(const OperationKey &key, /* **** Functions to build relations between entities **** */ +void DepsgraphRelationBuilder::begin_build(Main *bmain) +{ + /* LIB_TAG_DOIT is used to indicate whether node for given ID was already + * created or not. + */ + BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false); + /* XXX nested node trees are notr included in tag-clearing above, + * so we need to do this manually. + */ + FOREACH_NODETREE(bmain, nodetree, id) { + if (id != (ID *)nodetree) { + nodetree->id.tag &= ~LIB_TAG_DOIT; + } + } FOREACH_NODETREE_END +} + void DepsgraphRelationBuilder::build_group(Main *bmain, Scene *scene, Object *object, @@ -489,7 +505,7 @@ void DepsgraphRelationBuilder::build_object(Main *bmain, Scene *scene, Object *o /* grease pencil */ if (ob->gpd) { - build_gpencil(&ob->id, ob->gpd); + build_gpencil(ob->gpd); } } @@ -1062,10 +1078,10 @@ void DepsgraphRelationBuilder::build_world(World *world) /* TODO: other settings? */ /* textures */ - build_texture_stack(world_id, world->mtex); + build_texture_stack(world->mtex); /* world's nodetree */ - build_nodetree(world_id, world->nodetree); + build_nodetree(world->nodetree); } void DepsgraphRelationBuilder::build_rigidbody(Scene *scene) @@ -1402,15 +1418,28 @@ void DepsgraphRelationBuilder::build_obdata_geom(Main *bmain, Scene *scene, Obje } /* materials */ - if (ob->totcol) { - int a; - - for (a = 1; a <= ob->totcol; a++) { + if (ob->totcol != 0) { + ComponentKey object_shading_key(&ob->id, DEPSNODE_TYPE_SHADING); + for (int a = 1; a <= ob->totcol; a++) { Material *ma = give_current_material(ob, a); - - if (ma) - build_material(&ob->id, ma); + if (ma != NULL) { + build_material(ma); + ComponentKey material_shading_key(&ma->id, + DEPSNODE_TYPE_SHADING); + add_relation(material_shading_key, + object_shading_key, + DEPSREL_TYPE_UPDATE, + "Object Shading"); + } } + OperationKey obdata_geom_done_key(obdata, + DEPSNODE_TYPE_GEOMETRY, + DEG_OPCODE_PLACEHOLDER, + "Eval Done"); + add_relation(geom_key, + object_shading_key, + DEPSREL_TYPE_UPDATE, + "Object Shading"); } /* geometry collision */ @@ -1568,17 +1597,17 @@ void DepsgraphRelationBuilder::build_lamp(Object *ob) /* lamp's nodetree */ if (la->nodetree) { - build_nodetree(lamp_id, la->nodetree); + build_nodetree(la->nodetree); ComponentKey nodetree_key(&la->nodetree->id, DEPSNODE_TYPE_PARAMETERS); add_relation(nodetree_key, parameters_key, DEPSREL_TYPE_COMPONENT_ORDER, "NTree->Lamp Parameters"); } /* textures */ - build_texture_stack(lamp_id, la->mtex); + build_texture_stack(la->mtex); } -void DepsgraphRelationBuilder::build_nodetree(ID *owner, bNodeTree *ntree) +void DepsgraphRelationBuilder::build_nodetree(bNodeTree *ntree) { if (!ntree) return; @@ -1596,15 +1625,15 @@ void DepsgraphRelationBuilder::build_nodetree(ID *owner, bNodeTree *ntree) LINKLIST_FOREACH (bNode *, bnode, &ntree->nodes) { if (bnode->id) { if (GS(bnode->id->name) == ID_MA) { - build_material(owner, (Material *)bnode->id); + build_material((Material *)bnode->id); } else if (bnode->type == ID_TE) { - build_texture(owner, (Tex *)bnode->id); + build_texture((Tex *)bnode->id); } else if (bnode->type == NODE_GROUP) { bNodeTree *group_ntree = (bNodeTree *)bnode->id; if ((group_ntree->id.tag & LIB_TAG_DOIT) == 0) { - build_nodetree(owner, group_ntree); + build_nodetree(group_ntree); group_ntree->id.tag |= LIB_TAG_DOIT; } OperationKey group_parameters_key(&group_ntree->id, @@ -1622,12 +1651,10 @@ void DepsgraphRelationBuilder::build_nodetree(ID *owner, bNodeTree *ntree) add_relation(animation_key, parameters_key, DEPSREL_TYPE_COMPONENT_ORDER, "NTree Parameters"); } - - // TODO: link from nodetree to owner_component? } /* Recursively build graph for material */ -void DepsgraphRelationBuilder::build_material(ID *owner, Material *ma) +void DepsgraphRelationBuilder::build_material(Material *ma) { ID *ma_id = &ma->id; if (ma_id->tag & LIB_TAG_DOIT) { @@ -1639,14 +1666,26 @@ void DepsgraphRelationBuilder::build_material(ID *owner, Material *ma) build_animdata(ma_id); /* textures */ - build_texture_stack(owner, ma->mtex); + build_texture_stack(ma->mtex); /* material's nodetree */ - build_nodetree(owner, ma->nodetree); + if (ma->nodetree != NULL) { + build_nodetree(ma->nodetree); + OperationKey ntree_key(&ma->nodetree->id, + DEPSNODE_TYPE_PARAMETERS, + DEG_OPCODE_PLACEHOLDER, + "Parameters Eval"); + OperationKey material_key(&ma->id, + DEPSNODE_TYPE_SHADING, + DEG_OPCODE_PLACEHOLDER, + "Material Update"); + add_relation(ntree_key, material_key, + DEPSREL_TYPE_UPDATE, "Material's NTree"); + } } /* Recursively build graph for texture */ -void DepsgraphRelationBuilder::build_texture(ID *owner, Tex *tex) +void DepsgraphRelationBuilder::build_texture(Tex *tex) { ID *tex_id = &tex->id; if (tex_id->tag & LIB_TAG_DOIT) { @@ -1658,11 +1697,11 @@ void DepsgraphRelationBuilder::build_texture(ID *owner, Tex *tex) build_animdata(tex_id); /* texture's nodetree */ - build_nodetree(owner, tex->nodetree); + build_nodetree(tex->nodetree); } /* Texture-stack attached to some shading datablock */ -void DepsgraphRelationBuilder::build_texture_stack(ID *owner, MTex **texture_stack) +void DepsgraphRelationBuilder::build_texture_stack(MTex **texture_stack) { int i; @@ -1670,17 +1709,17 @@ void DepsgraphRelationBuilder::build_texture_stack(ID *owner, MTex **texture_sta for (i = 0; i < MAX_MTEX; i++) { MTex *mtex = texture_stack[i]; if (mtex && mtex->tex) - build_texture(owner, mtex->tex); + build_texture(mtex->tex); } } void DepsgraphRelationBuilder::build_compositor(Scene *scene) { /* For now, just a plain wrapper? */ - build_nodetree(&scene->id, scene->nodetree); + build_nodetree(scene->nodetree); } -void DepsgraphRelationBuilder::build_gpencil(ID *UNUSED(owner), bGPdata *gpd) +void DepsgraphRelationBuilder::build_gpencil(bGPdata *gpd) { /* animation */ build_animdata(&gpd->id); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h b/source/blender/depsgraph/intern/builder/deg_builder_relations.h index 6e8485bee30..054e4103290 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h @@ -171,6 +171,8 @@ struct DepsgraphRelationBuilder { DepsgraphRelationBuilder(Depsgraph *graph); + void begin_build(Main *bmain); + template <typename KeyFrom, typename KeyTo> void add_relation(const KeyFrom& key_from, const KeyTo& key_to, @@ -217,12 +219,12 @@ struct DepsgraphRelationBuilder void build_obdata_geom(Main *bmain, Scene *scene, Object *ob); void build_camera(Object *ob); void build_lamp(Object *ob); - void build_nodetree(ID *owner, bNodeTree *ntree); - void build_material(ID *owner, Material *ma); - void build_texture(ID *owner, Tex *tex); - void build_texture_stack(ID *owner, MTex **texture_stack); + void build_nodetree(bNodeTree *ntree); + void build_material(Material *ma); + void build_texture(Tex *tex); + void build_texture_stack(MTex **texture_stack); void build_compositor(Scene *scene); - void build_gpencil(ID *owner, bGPdata *gpd); + void build_gpencil(bGPdata *gpd); void build_cachefile(CacheFile *cache_file); void build_mask(Mask *mask); void build_movieclip(MovieClip *clip); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_scene.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_scene.cc index 6b51a957da0..8a3476cff45 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_scene.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_scene.cc @@ -69,20 +69,8 @@ namespace DEG { void DepsgraphRelationBuilder::build_scene(Main *bmain, Scene *scene) { - /* LIB_TAG_DOIT is used to indicate whether node for given ID was already - * created or not. - */ - BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false); - /* XXX nested node trees are not included in tag-clearing above, - * so we need to do this manually. - */ - FOREACH_NODETREE(bmain, nodetree, id) { - if (id != (ID *)nodetree) - nodetree->id.tag &= ~LIB_TAG_DOIT; - } FOREACH_NODETREE_END - if (scene->set) { - // TODO: link set to scene, especially our timesource... + build_scene(bmain, scene->set); } /* scene objects */ @@ -132,7 +120,7 @@ void DepsgraphRelationBuilder::build_scene(Main *bmain, Scene *scene) /* grease pencil */ if (scene->gpd) { - build_gpencil(&scene->id, scene->gpd); + build_gpencil(scene->gpd); } /* Masks. */ diff --git a/source/blender/depsgraph/intern/depsgraph_build.cc b/source/blender/depsgraph/intern/depsgraph_build.cc index 9952f714145..3a69469053c 100644 --- a/source/blender/depsgraph/intern/depsgraph_build.cc +++ b/source/blender/depsgraph/intern/depsgraph_build.cc @@ -209,6 +209,7 @@ void DEG_graph_build_from_scene(Depsgraph *graph, Main *bmain, Scene *scene) * - this way it should be the first in the graph, * reflecting its role as the entrypoint */ + node_builder.begin_build(bmain); node_builder.add_root_node(); node_builder.build_scene(bmain, scene); @@ -221,6 +222,7 @@ void DEG_graph_build_from_scene(Depsgraph *graph, Main *bmain, Scene *scene) * it doesnt add any operations anyway and is not clear what part of the * scene is to be connected. */ + relation_builder.begin_build(bmain); #if 0 relation_builder.add_relation(RootKey(), IDKey(scene), diff --git a/source/blender/depsgraph/intern/depsgraph_type_defines.cc b/source/blender/depsgraph/intern/depsgraph_type_defines.cc index 4ce91516c84..39c189629f2 100644 --- a/source/blender/depsgraph/intern/depsgraph_type_defines.cc +++ b/source/blender/depsgraph/intern/depsgraph_type_defines.cc @@ -145,7 +145,7 @@ DepsOperationStringifier::DepsOperationStringifier() const char *DepsOperationStringifier::operator[](eDepsOperation_Code opcode) { - BLI_assert((opcode > 0) && (opcode < DEG_NUM_OPCODES)); + BLI_assert((opcode >= 0) && (opcode < DEG_NUM_OPCODES)); if (opcode >= 0 && opcode < DEG_NUM_OPCODES) { return names_[opcode]; } diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index b02a909d009..7262b453e02 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -581,6 +581,9 @@ static void ui_item_enum_expand( UI_block_layout_set_current(block, layout_radial); } else { + if (layout->item.type == ITEM_LAYOUT_RADIAL) { + layout_radial = layout; + } UI_block_layout_set_current(block, layout); } } @@ -593,8 +596,9 @@ static void ui_item_enum_expand( for (item = item_array; item->identifier; item++) { if (!item->identifier[0]) { - if (radial) + if (radial && layout_radial) { uiItemS(layout_radial); + } continue; } diff --git a/source/blender/editors/space_info/textview.c b/source/blender/editors/space_info/textview.c index b82972853e2..d3c8fed5fc1 100644 --- a/source/blender/editors/space_info/textview.c +++ b/source/blender/editors/space_info/textview.c @@ -194,7 +194,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str unsigned pos = add_attrib(format, "pos", GL_INT, 2, CONVERT_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); - immUniformColor4ubv(bg); + immUniformColor3ubv(bg); immRecti(pos, 0, cdc->xy[1], cdc->winx, (cdc->xy[1] + (cdc->lheight * tot_lines))); immUnbindProgram(); @@ -248,7 +248,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str unsigned pos = add_attrib(format, "pos", GL_INT, 2, CONVERT_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); - immUniformColor4ubv(bg); + immUniformColor3ubv(bg); immRecti(pos, 0, cdc->xy[1], cdc->winx, cdc->xy[1] + cdc->lheight); immUnbindProgram(); diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index c3f2d05b0fb..e02c69ea857 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -1587,17 +1587,6 @@ static void node_composit_buts_zcombine(uiLayout *layout, bContext *UNUSED(C), P uiItemR(col, ptr, "use_antialias_z", 0, NULL, ICON_NONE); } - -static void node_composit_buts_hue_sat(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiLayout *col; - - col = uiLayoutColumn(layout, false); - uiItemR(col, ptr, "color_hue", UI_ITEM_R_SLIDER, NULL, ICON_NONE); - uiItemR(col, ptr, "color_saturation", UI_ITEM_R_SLIDER, NULL, ICON_NONE); - uiItemR(col, ptr, "color_value", UI_ITEM_R_SLIDER, NULL, ICON_NONE); -} - static void node_composit_buts_dilateerode(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE); @@ -2556,9 +2545,6 @@ static void node_composit_set_butfunc(bNodeType *ntype) case CMP_NODE_ALPHAOVER: ntype->draw_buttons = node_composit_buts_alphaover; break; - case CMP_NODE_HUE_SAT: - ntype->draw_buttons = node_composit_buts_hue_sat; - break; case CMP_NODE_TEXTURE: ntype->draw_buttons = node_buts_texture; break; diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h index 3a7e2b6f7f8..fd601e55550 100644 --- a/source/blender/makesdna/DNA_node_types.h +++ b/source/blender/makesdna/DNA_node_types.h @@ -595,6 +595,7 @@ typedef struct NodeBilateralBlurData { short iter, pad; } NodeBilateralBlurData; +/* NOTE: Only for do-version code. */ typedef struct NodeHueSat { float hue, sat, val; } NodeHueSat; diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index a9e78428212..b35142f2a58 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -4443,34 +4443,6 @@ static void def_cmp_alpha_over(StructRNA *srna) RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); } -static void def_cmp_hue_saturation(StructRNA *srna) -{ - PropertyRNA *prop; - - RNA_def_struct_sdna_from(srna, "NodeHueSat", "storage"); - - prop = RNA_def_property(srna, "color_hue", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "hue"); - RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_float_default(prop, 0.5f); - RNA_def_property_ui_text(prop, "Hue", ""); - RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); - - prop = RNA_def_property(srna, "color_saturation", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "sat"); - RNA_def_property_range(prop, 0.0f, 2.0f); - RNA_def_property_ui_text(prop, "Saturation", ""); - RNA_def_property_float_default(prop, 1.0f); - RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); - - prop = RNA_def_property(srna, "color_value", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "val"); - RNA_def_property_range(prop, 0.0f, 2.0f); - RNA_def_property_ui_text(prop, "Value", ""); - RNA_def_property_float_default(prop, 1.0f); - RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); -} - static void def_cmp_blur(StructRNA *srna) { PropertyRNA *prop; diff --git a/source/blender/nodes/NOD_static_types.h b/source/blender/nodes/NOD_static_types.h index 171d5313c1d..a9c0df7d7e8 100644 --- a/source/blender/nodes/NOD_static_types.h +++ b/source/blender/nodes/NOD_static_types.h @@ -145,7 +145,7 @@ DefNode( CompositorNode, CMP_NODE_VECBLUR, def_cmp_vector_blur, "VECBL DefNode( CompositorNode, CMP_NODE_SEPRGBA, 0, "SEPRGBA", SepRGBA, "Separate RGBA", "" ) DefNode( CompositorNode, CMP_NODE_SEPHSVA, 0, "SEPHSVA", SepHSVA, "Separate HSVA", "" ) DefNode( CompositorNode, CMP_NODE_SETALPHA, 0, "SETALPHA", SetAlpha, "Set Alpha", "" ) -DefNode( CompositorNode, CMP_NODE_HUE_SAT, def_cmp_hue_saturation, "HUE_SAT", HueSat, "Hue Saturation Value","" ) +DefNode( CompositorNode, CMP_NODE_HUE_SAT, 0, "HUE_SAT", HueSat, "Hue Saturation Value","" ) DefNode( CompositorNode, CMP_NODE_IMAGE, def_cmp_image, "IMAGE", Image, "Image", "" ) DefNode( CompositorNode, CMP_NODE_R_LAYERS, def_cmp_render_layers, "R_LAYERS", RLayers, "Render Layers", "" ) DefNode( CompositorNode, CMP_NODE_COMPOSITE, def_cmp_composite, "COMPOSITE", Composite, "Composite", "" ) diff --git a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c index 1c31f4863ca..952ba78aff3 100644 --- a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c +++ b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c @@ -35,8 +35,11 @@ /* **************** Hue Saturation ******************** */ static bNodeSocketTemplate cmp_node_hue_sat_in[] = { - { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, + { SOCK_FLOAT, 1, N_("Hue"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, + { SOCK_FLOAT, 1, N_("Saturation"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, + { SOCK_FLOAT, 1, N_("Value"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, + { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { -1, 0, "" } }; static bNodeSocketTemplate cmp_node_hue_sat_out[] = { @@ -44,23 +47,12 @@ static bNodeSocketTemplate cmp_node_hue_sat_out[] = { { -1, 0, "" } }; -static void node_composit_init_hue_sat(bNodeTree *UNUSED(ntree), bNode *node) -{ - NodeHueSat *nhs = MEM_callocN(sizeof(NodeHueSat), "node hue sat"); - node->storage = nhs; - nhs->hue = 0.5f; - nhs->sat = 1.0f; - nhs->val = 1.0f; -} - void register_node_type_cmp_hue_sat(void) { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR, 0); node_type_socket_templates(&ntype, cmp_node_hue_sat_in, cmp_node_hue_sat_out); - node_type_init(&ntype, node_composit_init_hue_sat); - node_type_storage(&ntype, "NodeHueSat", node_free_standard_storage, node_copy_standard_storage); nodeRegisterType(&ntype); } diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index aff0d2cf15f..52eca5f7005 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -3440,7 +3440,7 @@ bool RE_WriteRenderViewsMovie( ok = mh->append_movie(movie_ctx_arr[0], rd, preview ? scene->r.psfra : scene->r.sfra, scene->r.cfra, (int *) ibuf_arr[2]->rect, ibuf_arr[2]->x, ibuf_arr[2]->y, "", reports); - for (i = 0; i < 2; i++) { + for (i = 0; i < 3; i++) { /* imbuf knows which rects are not part of ibuf */ IMB_freeImBuf(ibuf_arr[i]); } diff --git a/tests/gtests/CMakeLists.txt b/tests/gtests/CMakeLists.txt index a3860ce3e67..1d363f31119 100644 --- a/tests/gtests/CMakeLists.txt +++ b/tests/gtests/CMakeLists.txt @@ -4,6 +4,9 @@ if(WITH_GTESTS) Include(GTestTesting) + add_definitions(${GFLAGS_DEFINES}) + add_definitions(${GLOG_DEFINES}) + # Otherwise we get warnings here that we cant fix in external projects remove_strict_flags() diff --git a/tests/gtests/blenlib/BLI_string_test.cc b/tests/gtests/blenlib/BLI_string_test.cc index 17a4b5e82b9..08f2a745bdb 100644 --- a/tests/gtests/blenlib/BLI_string_test.cc +++ b/tests/gtests/blenlib/BLI_string_test.cc @@ -374,7 +374,7 @@ TEST(string, StrFormatIntGrouped) const int word_num = BLI_string_find_split_words( \ word_str_src, word_str_src_len, ' ', word_info, word_cmp_size_input); \ EXPECT_EQ(word_num, word_cmp_size - 1); \ - EXPECT_EQ_ARRAY_ND(word_cmp, word_info, word_cmp_size, 2); \ + EXPECT_EQ_ARRAY_ND<const int[2]>(word_cmp, word_info, word_cmp_size, 2); \ } ((void)0) #define STRING_FIND_SPLIT_WORDS(word_str_src, ...) \ diff --git a/tests/gtests/testing/CMakeLists.txt b/tests/gtests/testing/CMakeLists.txt index 1eb60e7f3b5..796f975ea65 100644 --- a/tests/gtests/testing/CMakeLists.txt +++ b/tests/gtests/testing/CMakeLists.txt @@ -47,7 +47,4 @@ set(SRC testing.h ) -add_definitions(${GFLAGS_DEFINES}) -add_definitions(${GLOG_DEFINES}) - blender_add_lib(bf_testing_main "${SRC}" "${INC}" "${INC_SYS}") diff --git a/tests/python/CMakeLists.txt b/tests/python/CMakeLists.txt index ee10ee87506..4e0283adf88 100644 --- a/tests/python/CMakeLists.txt +++ b/tests/python/CMakeLists.txt @@ -399,24 +399,28 @@ endif() if(WITH_CYCLES) if(OPENIMAGEIO_IDIFF AND EXISTS "${TEST_SRC_DIR}/cycles/ctests/shader") - add_test(cycles_reports_test - ${CMAKE_CURRENT_LIST_DIR}/cycles_render_tests.py - -blender "${TEST_BLENDER_EXE_BARE}" - -testdir "${TEST_SRC_DIR}/cycles/ctests/reports" - -idiff "${OPENIMAGEIO_IDIFF}" - ) - add_test(cycles_render_test - ${CMAKE_CURRENT_LIST_DIR}/cycles_render_tests.py - -blender "${TEST_BLENDER_EXE_BARE}" - -testdir "${TEST_SRC_DIR}/cycles/ctests/render" - -idiff "${OPENIMAGEIO_IDIFF}" - ) - add_test(cycles_shaders_test - ${CMAKE_CURRENT_LIST_DIR}/cycles_render_tests.py - -blender "${TEST_BLENDER_EXE_BARE}" - -testdir "${TEST_SRC_DIR}/cycles/ctests/shader" - -idiff "${OPENIMAGEIO_IDIFF}" - ) + macro(add_cycles_render_test subject) + if(MSVC) + add_test(NAME cycles_${subject}_test + COMMAND + "$<TARGET_FILE_DIR:blender>/${BLENDER_VERSION_MAJOR}.${BLENDER_VERSION_MINOR}/python/bin/python$<$<CONFIG:Debug>:_d>" + ${CMAKE_CURRENT_LIST_DIR}/cycles_render_tests.py + -blender "$<TARGET_FILE:blender>" + -testdir "${TEST_SRC_DIR}/cycles/ctests/${subject}" + -idiff "${OPENIMAGEIO_IDIFF}" + ) + else() + add_test(cycles_${subject}_test + ${CMAKE_CURRENT_LIST_DIR}/cycles_render_tests.py + -blender "${TEST_BLENDER_EXE_BARE}" + -testdir "${TEST_SRC_DIR}/cycles/ctests/${subject}" + -idiff "${OPENIMAGEIO_IDIFF}" + ) + endif() + endmacro() + add_cycles_render_test(reports) + add_cycles_render_test(render) + add_cycles_render_test(shader) else() MESSAGE(STATUS "Disabling Cycles tests because tests folder does not exist") endif() |