Merge branch 'blender-v2.82-release'

This commit is contained in:
Brecht Van Lommel 2020-01-20 14:53:14 +01:00
commit a5270d4cf3
20 changed files with 42 additions and 38 deletions

View File

@ -14,6 +14,9 @@ Local modifications:
* Disabeld HAVE_FNMATCH_H
* Forced disabled GFLAGS_IS_A_DLL
- gflags_declare.h was modified
* Forced disabled GFLAGS_IS_A_DLL
- Applied some modifications from fork https://github.com/Nazg-Gul/gflags.git
(see https://github.com/gflags/gflags/pull/129)

View File

@ -51,7 +51,7 @@
// Must be overwritten when this header file is used with the optionally also
// built static library instead; set by CMake's INTERFACE_COMPILE_DEFINITIONS.
#ifndef GFLAGS_IS_A_DLL
# define GFLAGS_IS_A_DLL 1
# define GFLAGS_IS_A_DLL 0
#endif
// We always want to import the symbols of the gflags library.

View File

@ -64,14 +64,7 @@ void Background::device_update(Device *device, DeviceScene *dscene, Scene *scene
device_free(device, dscene);
Shader *bg_shader = shader;
if (use_shader) {
if (!bg_shader)
bg_shader = scene->default_background;
}
else
bg_shader = scene->default_empty;
Shader *bg_shader = get_shader(scene);
/* set shader index and transparent option */
KernelBackground *kbackground = &dscene->data.background;
@ -134,4 +127,9 @@ void Background::tag_update(Scene *scene)
need_update = true;
}
Shader *Background::get_shader(const Scene *scene)
{
return (use_shader) ? ((shader) ? shader : scene->default_background) : scene->default_empty;
}
CCL_NAMESPACE_END

View File

@ -55,6 +55,8 @@ class Background : public Node {
bool modified(const Background &background);
void tag_update(Scene *scene);
Shader *get_shader(const Scene *scene);
};
CCL_NAMESPACE_END

View File

@ -219,8 +219,7 @@ void LightManager::disable_ineffective_light(Scene *scene)
* - If unsupported on a device
* - If we don't need it (no HDRs etc.)
*/
Shader *shader = (scene->background->shader) ? scene->background->shader :
scene->default_background;
Shader *shader = scene->background->get_shader(scene);
const bool disable_mis = !(has_portal || shader->has_surface_spatial_varying);
VLOG_IF(1, disable_mis) << "Background MIS has been disabled.\n";
foreach (Light *light, scene->lights) {
@ -569,8 +568,7 @@ void LightManager::device_update_background(Device *device,
int2 res = make_int2(background_light->map_resolution, background_light->map_resolution / 2);
/* If the resolution isn't set manually, try to find an environment texture. */
if (res.x == 0) {
Shader *shader = (scene->background->shader) ? scene->background->shader :
scene->default_background;
Shader *shader = scene->background->get_shader(scene);
foreach (ShaderNode *node, shader->graph->nodes) {
if (node->type == EnvironmentTextureNode::node_type) {
EnvironmentTextureNode *env = (EnvironmentTextureNode *)node;

View File

@ -16,6 +16,7 @@
#include "device/device.h"
#include "render/background.h"
#include "render/colorspace.h"
#include "render/graph.h"
#include "render/light.h"
@ -106,6 +107,7 @@ void OSLShaderManager::device_update(Device *device,
/* create shaders */
OSLGlobals *og = (OSLGlobals *)device->osl_memory();
Shader *background_shader = scene->background->get_shader(scene);
foreach (Shader *shader, scene->shaders) {
assert(shader->graph);
@ -119,7 +121,7 @@ void OSLShaderManager::device_update(Device *device,
thread_scoped_lock lock(ss_mutex);
OSLCompiler compiler(this, services, ss, scene);
compiler.background = (shader == scene->default_background);
compiler.background = (shader == background_shader);
compiler.compile(og, shader);
if (shader->use_mis && shader->has_surface_emission)
@ -131,7 +133,7 @@ void OSLShaderManager::device_update(Device *device,
og->ts = ts;
og->services = services;
int background_id = scene->shader_manager->get_shader_id(scene->default_background);
int background_id = scene->shader_manager->get_shader_id(background_shader);
og->background_state = og->surface_state[background_id & SHADER_MASK];
og->use = true;

View File

@ -317,7 +317,7 @@ void Shader::tag_update(Scene *scene)
* has use_mis set to false. We are quite close to release now, so
* better to be safe.
*/
if (this == scene->default_background && scene->light_manager->has_background_light(scene)) {
if (this == scene->background->get_shader(scene) && scene->light_manager->has_background_light(scene)) {
scene->light_manager->need_update = true;
}

View File

@ -15,6 +15,8 @@
*/
#include "device/device.h"
#include "render/background.h"
#include "render/graph.h"
#include "render/light.h"
#include "render/mesh.h"
@ -58,7 +60,7 @@ void SVMShaderManager::device_update_shader(Scene *scene,
SVMCompiler::Summary summary;
SVMCompiler compiler(scene);
compiler.background = (shader == scene->default_background);
compiler.background = (shader == scene->background->get_shader(scene));
compiler.compile(shader, *svm_nodes, 0, &summary);
VLOG(2) << "Compilation summary:\n"

View File

@ -573,7 +573,7 @@ def smoke_save_noise_$ID$(path, framenr, file_format, resumable):\n\
if resumable:\n\
fluid_file_export_s$ID$(dict=smoke_noise_dict_resume_s$ID$, framenr=framenr, file_format=file_format, path=path)\n\
else:\n\
fluid_cache_multiprocessing_start_$ID$(function=fluid_file_export_s$ID$, framenr=framenr, format_data=file_format, path_data=path, dict=smoke_noise_final_dict_s$ID$, do_join=False)\n\
fluid_cache_multiprocessing_start_$ID$(function=fluid_file_export_s$ID$, framenr=framenr, format_data=file_format, path_data=path, dict=smoke_noise_dict_final_s$ID$, do_join=False)\n\
if resumable:\n\
fluid_cache_multiprocessing_start_$ID$(function=fluid_file_export_s$ID$, framenr=framenr, format_data=file_format, path_data=path, dict=smoke_noise_dict_resume_s$ID$, do_join=False)\n";

View File

@ -184,7 +184,6 @@ void id_us_plus(struct ID *id);
void id_us_min(struct ID *id);
void id_fake_user_set(struct ID *id);
void id_fake_user_clear(struct ID *id);
int BKE_id_num_real_users(const struct ID *id);
void BKE_id_clear_newpoin(struct ID *id);
void BKE_id_make_local_generic(struct Main *bmain,

View File

@ -3826,7 +3826,8 @@ struct Mesh *BKE_fluid_modifier_do(
FluidDomainSettings *mds = mmd->domain;
/* Always update viewport in cache replay mode. */
if (mds->cache_type == FLUID_DOMAIN_CACHE_REPLAY) {
if (mds->cache_type == FLUID_DOMAIN_CACHE_REPLAY ||
mds->flags & FLUID_DOMAIN_USE_ADAPTIVE_DOMAIN) {
needs_viewport_update = true;
}
/* In other cache modes, only update the viewport when no bake is going on. */

View File

@ -294,11 +294,6 @@ void id_fake_user_clear(ID *id)
}
}
int BKE_id_num_real_users(const ID *id)
{
return (id->flag & LIB_FAKEUSER) ? id->us - 1 : id->us;
}
void BKE_id_clear_newpoin(ID *id)
{
if (id->newid) {

View File

@ -1014,12 +1014,12 @@ void MeshImporter::optimize_material_assignements()
++it) {
Object *ob = (*it);
Mesh *me = (Mesh *)ob->data;
if (BKE_id_num_real_users(&me->id) == 1) {
if (ID_REAL_USERS(&me->id) == 1) {
bc_copy_materials_to_data(ob, me);
bc_remove_materials_from_object(ob, me);
bc_remove_mark(ob);
}
else if (BKE_id_num_real_users(&me->id) > 1) {
else if (ID_REAL_USERS(&me->id) > 1) {
bool can_move = true;
std::vector<Object *> mesh_users = get_all_users_of(me);
if (mesh_users.size() > 1) {

View File

@ -768,6 +768,7 @@ static void eevee_lightbake_cache_create(EEVEE_Data *vedata, EEVEE_LightBake *lb
EEVEE_materials_cache_finish(sldata, vedata);
EEVEE_lights_cache_finish(sldata, vedata);
EEVEE_lightprobes_cache_finish(sldata, vedata);
EEVEE_shadows_update(sldata, vedata);
/* Disable volumetrics when baking. */
stl->effects->enabled_effects &= ~EFFECT_VOLUMETRIC;

View File

@ -177,7 +177,8 @@ void CLOSURE_NAME(vec3 N
out_refr = vec3(0.0);
#endif
#ifdef SHADOW_SHADER
#if defined(SHADOW_SHADER) || defined(WORLD_BACKGROUND)
/* This makes shader resources become unused and avoid issues with samplers. (see T59747) */
return;
#else

View File

@ -29,7 +29,6 @@
#include "BKE_constraint.h"
#include "BKE_curve.h"
#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_mball.h"
#include "BKE_mesh.h"
#include "BKE_movieclip.h"
@ -1019,6 +1018,11 @@ static void camera_stereoscopy_extra(OVERLAY_ExtraCallBuffers *cb,
const bool is_stereo3d_plane = (v3d->stereo3d_flag & V3D_S3D_DISPPLANE) != 0;
const bool is_stereo3d_volume = (v3d->stereo3d_flag & V3D_S3D_DISPVOLUME) != 0;
if (!is_stereo3d_cameras) {
/* Draw single camera. */
DRW_buffer_add_entry_struct(cb->camera_frame, instdata);
}
for (int eye = 0; eye < 2; eye++) {
ob = BKE_camera_multiview_render(scene, ob, viewnames[eye]);
BKE_camera_multiview_model_matrix(&scene->r, ob, viewnames[eye], stereodata.mat);
@ -1501,7 +1505,7 @@ static void OVERLAY_object_center(OVERLAY_ExtraCallBuffers *cb,
OVERLAY_PrivateData *pd,
ViewLayer *view_layer)
{
const bool is_library = BKE_id_num_real_users(&ob->id) > 1 || ID_IS_LINKED(ob);
const bool is_library = ID_REAL_USERS(&ob->id) > 1 || ID_IS_LINKED(ob);
if (ob == OBACT(view_layer)) {
DRW_buffer_add_entry(cb->center_active, ob->obmat[3]);

View File

@ -2325,7 +2325,7 @@ static int convert_exec(bContext *C, wmOperator *op)
if (!keep_original) {
/* other users */
if (BKE_id_num_real_users(&cu->id) > 1) {
if (ID_REAL_USERS(&cu->id) > 1) {
for (ob1 = bmain->objects.first; ob1; ob1 = ob1->id.next) {
if (ob1->data == ob->data) {
ob1->type = OB_CURVE;

View File

@ -7562,8 +7562,7 @@ static void sculpt_flush_update_done(const bContext *C, Object *ob, SculptUpdate
RegionView3D *rv3d = CTX_wm_region_view3d(C);
SculptSession *ss = ob->sculpt;
Mesh *mesh = ob->data;
bool need_tag = (BKE_id_num_real_users(&mesh->id) >
1); /* Always needed for linked duplicates. */
bool need_tag = (ID_REAL_USERS(&mesh->id) > 1); /* Always needed for linked duplicates. */
if (rv3d) {
rv3d->rflag &= ~RV3D_PAINTING;

View File

@ -46,7 +46,6 @@
#include "BKE_multires.h"
#include "BKE_paint.h"
#include "BKE_key.h"
#include "BKE_library.h"
#include "BKE_mesh.h"
#include "BKE_scene.h"
#include "BKE_subsurf.h"
@ -633,7 +632,7 @@ static void sculpt_undo_restore_list(bContext *C, Depsgraph *depsgraph, ListBase
}
}
tag_update |= BKE_id_num_real_users(ob->data) > 1 || !BKE_sculptsession_use_pbvh_draw(ob, v3d);
tag_update |= ID_REAL_USERS(ob->data) > 1 || !BKE_sculptsession_use_pbvh_draw(ob, v3d);
if (ss->shapekey_active || ss->deform_modifiers_active) {
Mesh *mesh = ob->data;

View File

@ -616,12 +616,12 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks)
continue;
}
/* Add end slash for consistency with other platforms */
BLI_add_slash(line);
/* Exclude "all my files" as it makes no sense in blender fileselector */
/* Exclude "airdrop" if wlan not active as it would show "" ) */
if (!strstr(line, "myDocuments.cannedSearch") && (*line != '\0')) {
/* Add end slash for consistency with other platforms */
BLI_add_slash(line);
fsmenu_insert_entry(
fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, line, NULL, ICON_FILE_FOLDER, FS_INSERT_LAST);
}