Merge branch 'blender-v2.83-release'

This commit is contained in:
Philipp Oeser 2020-05-19 13:59:39 +02:00
commit 325307d82b
17 changed files with 94 additions and 44 deletions

View File

@ -281,7 +281,7 @@ option(WITH_ALEMBIC "Enable Alembic Support" ON)
option(WITH_ALEMBIC_HDF5 "Enable Legacy Alembic Support (not officially supported)" OFF)
# Universal Scene Description support
option(WITH_USD "Enable Universal Scene Description (USD) Support" OFF)
option(WITH_USD "Enable Universal Scene Description (USD) Support" ON)
# 3D format support
# Disable opencollada when we don't have precompiled libs

View File

@ -237,7 +237,7 @@ class PHYSICS_PT_settings(PhysicButtonsPanel, Panel):
col = grid.column()
col.prop(flow, "flow_behavior", expand=False)
if flow.flow_behavior in {'INFLOW', 'OUTFLOW'}:
col.prop(flow, "use_inflow", text="Use Flow")
col.prop(flow, "use_inflow")
col.prop(flow, "subframes", text="Sampling Substeps")

View File

@ -90,7 +90,7 @@ void BKE_armature_bone_hash_free(struct bArmature *arm);
bool BKE_armature_bone_flag_test_recursive(const struct Bone *bone, int flag);
void BKE_armature_refresh_layer_used(struct bArmature *arm);
void BKE_armature_refresh_layer_used(struct Depsgraph *depsgraph, struct bArmature *arm);
float distfactor_to_bone(
const float vec[3], const float b1[3], const float b2[3], float r1, float r2, float rdist);

View File

@ -309,6 +309,8 @@ void BKE_pbvh_face_sets_set(PBVH *bvh, int *face_sets);
void BKE_pbvh_face_sets_color_set(PBVH *bvh, int seed, int color_default);
void BKE_pbvh_respect_hide_set(PBVH *bvh, bool respect_hide);
/* vertex deformer */
float (*BKE_pbvh_vert_coords_alloc(struct PBVH *pbvh))[3];
void BKE_pbvh_vert_coords_apply(struct PBVH *pbvh, const float (*vertCos)[3], const int totvert);
@ -334,6 +336,7 @@ typedef struct PBVHVertexIter {
int gy;
int i;
int index;
bool respect_hide;
/* grid */
struct CCGKey key;
@ -402,9 +405,15 @@ void pbvh_vertex_iter_init(PBVH *bvh, PBVHNode *node, PBVHVertexIter *vi, int mo
} \
else if (vi.mverts) { \
vi.mvert = &vi.mverts[vi.vert_indices[vi.gx]]; \
vi.visible = !(vi.mvert->flag & ME_HIDE); \
if (mode == PBVH_ITER_UNIQUE && !vi.visible) \
continue; \
if (vi.respect_hide) { \
vi.visible = !(vi.mvert->flag & ME_HIDE); \
if (mode == PBVH_ITER_UNIQUE && !vi.visible) { \
continue; \
} \
} \
else { \
BLI_assert(vi.visible); \
} \
vi.co = vi.mvert->co; \
vi.no = vi.mvert->no; \
vi.index = vi.vert_indices[vi.i]; \

View File

@ -67,6 +67,7 @@
#include "BKE_scene.h"
#include "DEG_depsgraph_build.h"
#include "DEG_depsgraph_query.h"
#include "BIK_api.h"
@ -500,14 +501,21 @@ static void armature_refresh_layer_used_recursive(bArmature *arm, ListBase *bone
}
}
/* Update the layers_used variable after bones are moved between layer
* NOTE: Used to be done in drawing code in 2.7, but that won't work with
* Copy-on-Write, as drawing uses evaluated copies.
*/
void BKE_armature_refresh_layer_used(bArmature *arm)
void BKE_armature_refresh_layer_used(struct Depsgraph *depsgraph, struct bArmature *arm)
{
if (arm->edbo != NULL) {
/* Don't perform this update when the armature is in edit mode. In that case it should be
* handled by ED_armature_edit_refresh_layer_used(). */
return;
}
arm->layer_used = 0;
armature_refresh_layer_used_recursive(arm, &arm->bonebase);
if (depsgraph == NULL || DEG_is_active(depsgraph)) {
bArmature *arm_orig = (bArmature *)DEG_get_original_id(&arm->id);
arm_orig->layer_used = arm->layer_used;
}
}
/* Finds the best possible extension to the name on a particular axis. (For renaming, check for

View File

@ -1480,6 +1480,7 @@ static void sculpt_update_object(
SculptSession *ss = ob->sculpt;
Mesh *me = BKE_object_get_original_mesh(ob);
MultiresModifierData *mmd = BKE_sculpt_multires_active(scene, ob);
const bool use_face_sets = (ob->mode & OB_MODE_SCULPT) != 0;
ss->deform_modifiers_active = sculpt_modifiers_active(scene, sd, ob);
ss->show_mask = (sd->flags & SCULPT_HIDE_MASK) == 0;
@ -1535,17 +1536,22 @@ static void sculpt_update_object(
}
/* Sculpt Face Sets. */
if (!CustomData_has_layer(&me->pdata, CD_SCULPT_FACE_SETS)) {
ss->face_sets = CustomData_add_layer(
&me->pdata, CD_SCULPT_FACE_SETS, CD_CALLOC, NULL, me->totpoly);
for (int i = 0; i < me->totpoly; i++) {
ss->face_sets[i] = 1;
}
if (use_face_sets) {
if (!CustomData_has_layer(&me->pdata, CD_SCULPT_FACE_SETS)) {
ss->face_sets = CustomData_add_layer(
&me->pdata, CD_SCULPT_FACE_SETS, CD_CALLOC, NULL, me->totpoly);
for (int i = 0; i < me->totpoly; i++) {
ss->face_sets[i] = 1;
}
/* Set the default face set color if the datalayer did not exist. */
me->face_sets_color_default = 1;
/* Set the default face set color if the datalayer did not exist. */
me->face_sets_color_default = 1;
}
ss->face_sets = CustomData_get_layer(&me->pdata, CD_SCULPT_FACE_SETS);
}
else {
ss->face_sets = NULL;
}
ss->face_sets = CustomData_get_layer(&me->pdata, CD_SCULPT_FACE_SETS);
ss->subdiv_ccg = me_eval->runtime.subdiv_ccg;
@ -1805,11 +1811,12 @@ static PBVH *build_pbvh_for_dynamic_topology(Object *ob)
return pbvh;
}
static PBVH *build_pbvh_from_regular_mesh(Object *ob, Mesh *me_eval_deform)
static PBVH *build_pbvh_from_regular_mesh(Object *ob, Mesh *me_eval_deform, bool respect_hide)
{
Mesh *me = BKE_object_get_original_mesh(ob);
const int looptris_num = poly_to_tri_count(me->totpoly, me->totloop);
PBVH *pbvh = BKE_pbvh_new();
BKE_pbvh_respect_hide_set(pbvh, respect_hide);
MLoopTri *looptri = MEM_malloc_arrayN(looptris_num, sizeof(*looptri), __func__);
@ -1841,11 +1848,12 @@ static PBVH *build_pbvh_from_regular_mesh(Object *ob, Mesh *me_eval_deform)
return pbvh;
}
static PBVH *build_pbvh_from_ccg(Object *ob, SubdivCCG *subdiv_ccg)
static PBVH *build_pbvh_from_ccg(Object *ob, SubdivCCG *subdiv_ccg, bool respect_hide)
{
CCGKey key;
BKE_subdiv_ccg_key_top_level(&key, subdiv_ccg);
PBVH *pbvh = BKE_pbvh_new();
BKE_pbvh_respect_hide_set(pbvh, respect_hide);
BKE_pbvh_build_grids(pbvh,
subdiv_ccg->grids,
subdiv_ccg->num_grids,
@ -1863,6 +1871,14 @@ PBVH *BKE_sculpt_object_pbvh_ensure(Depsgraph *depsgraph, Object *ob)
if (ob == NULL || ob->sculpt == NULL) {
return NULL;
}
bool respect_hide = true;
if (ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT)) {
if (!(BKE_paint_select_vert_test(ob) || BKE_paint_select_face_test(ob))) {
respect_hide = false;
}
}
PBVH *pbvh = ob->sculpt->pbvh;
if (pbvh != NULL) {
/* NOTE: It is possible that grids were re-allocated due to modifier
@ -1886,11 +1902,11 @@ PBVH *BKE_sculpt_object_pbvh_ensure(Depsgraph *depsgraph, Object *ob)
Object *object_eval = DEG_get_evaluated_object(depsgraph, ob);
Mesh *mesh_eval = object_eval->data;
if (mesh_eval->runtime.subdiv_ccg != NULL) {
pbvh = build_pbvh_from_ccg(ob, mesh_eval->runtime.subdiv_ccg);
pbvh = build_pbvh_from_ccg(ob, mesh_eval->runtime.subdiv_ccg, respect_hide);
}
else if (ob->type == OB_MESH) {
Mesh *me_eval_deform = object_eval->runtime.mesh_deform_eval;
pbvh = build_pbvh_from_regular_mesh(ob, me_eval_deform);
pbvh = build_pbvh_from_regular_mesh(ob, me_eval_deform, respect_hide);
}
}

View File

@ -295,6 +295,10 @@ static void build_mesh_leaf_node(PBVH *bvh, PBVHNode *node)
node->face_vert_indices = (const int(*)[3])face_vert_indices;
if (bvh->respect_hide == false) {
has_visible = true;
}
for (int i = 0; i < totface; i++) {
const MLoopTri *lt = &bvh->looptri[node->prim_indices[i]];
for (int j = 0; j < 3; j++) {
@ -302,8 +306,10 @@ static void build_mesh_leaf_node(PBVH *bvh, PBVHNode *node)
bvh, map, &node->face_verts, &node->uniq_verts, bvh->mloop[lt->tri[j]].v);
}
if (!paint_is_face_hidden(lt, bvh->verts, bvh->mloop)) {
has_visible = true;
if (has_visible == false) {
if (!paint_is_face_hidden(lt, bvh->verts, bvh->mloop)) {
has_visible = true;
}
}
}
@ -666,7 +672,7 @@ void BKE_pbvh_build_grids(PBVH *bvh,
PBVH *BKE_pbvh_new(void)
{
PBVH *bvh = MEM_callocN(sizeof(PBVH), "pbvh");
bvh->respect_hide = true;
return bvh;
}
@ -2117,7 +2123,7 @@ static bool pbvh_faces_node_raycast(PBVH *bvh,
const MLoopTri *lt = &bvh->looptri[faces[i]];
const int *face_verts = node->face_vert_indices[i];
if (paint_is_face_hidden(lt, vert, mloop)) {
if (bvh->respect_hide && paint_is_face_hidden(lt, vert, mloop)) {
continue;
}
@ -2426,7 +2432,7 @@ static bool pbvh_faces_node_nearest_to_ray(PBVH *bvh,
const MLoopTri *lt = &bvh->looptri[faces[i]];
const int *face_verts = node->face_vert_indices[i];
if (paint_is_face_hidden(lt, vert, mloop)) {
if (bvh->respect_hide && paint_is_face_hidden(lt, vert, mloop)) {
continue;
}
@ -2900,6 +2906,12 @@ void pbvh_vertex_iter_init(PBVH *bvh, PBVHNode *node, PBVHVertexIter *vi, int mo
vi->fno = NULL;
vi->mvert = NULL;
vi->respect_hide = bvh->respect_hide;
if (bvh->respect_hide == false) {
/* The same value for all vertices. */
vi->visible = true;
}
BKE_pbvh_node_get_grids(bvh, node, &grid_indices, &totgrid, NULL, &gridsize, &grids);
BKE_pbvh_node_num_verts(bvh, node, &uniq_verts, &totvert);
BKE_pbvh_node_get_verts(bvh, node, &vert_indices, &verts);
@ -3014,3 +3026,8 @@ void BKE_pbvh_face_sets_set(PBVH *bvh, int *face_sets)
{
bvh->face_sets = face_sets;
}
void BKE_pbvh_respect_hide_set(PBVH *bvh, bool respect_hide)
{
bvh->respect_hide = respect_hide;
}

View File

@ -160,6 +160,7 @@ struct PBVH {
bool deformed;
bool show_mask;
bool show_face_sets;
bool respect_hide;
/* Dynamic topology */
BMesh *bm;

View File

@ -1402,7 +1402,11 @@ void DepsgraphNodeBuilder::build_armature(bArmature *armature)
build_animdata(&armature->id);
build_parameters(&armature->id);
/* Make sure pose is up-to-date with armature updates. */
add_operation_node(&armature->id, NodeType::ARMATURE, OperationCode::ARMATURE_EVAL);
bArmature *armature_cow = (bArmature *)get_cow_id(&armature->id);
add_operation_node(&armature->id,
NodeType::ARMATURE,
OperationCode::ARMATURE_EVAL,
function_bind(BKE_armature_refresh_layer_used, _1, armature_cow));
build_armature_bones(&armature->bonebase);
}

View File

@ -432,7 +432,6 @@ int join_armature_exec(bContext *C, wmOperator *op)
ED_armature_from_edit(bmain, arm);
ED_armature_edit_free(arm);
BKE_armature_refresh_layer_used(arm);
DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
@ -689,9 +688,7 @@ static int separate_armature_exec(bContext *C, wmOperator *op)
/* 5) restore original conditions */
ED_armature_to_edit(ob_old->data);
ED_armature_edit_refresh_layer_used(ob_old->data);
BKE_armature_refresh_layer_used(ob_new->data);
/* parents tips remain selected when connected children are removed. */
ED_armature_edit_deselect_all(ob_old);

View File

@ -906,8 +906,6 @@ static int pose_bone_layers_exec(bContext *C, wmOperator *op)
RNA_boolean_set_array(&ptr, "layers", layers);
if (prev_ob != ob) {
BKE_armature_refresh_layer_used(ob->data);
/* Note, notifier might evolve. */
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);
DEG_id_tag_update((ID *)ob->data, ID_RECALC_COPY_ON_WRITE);

View File

@ -301,8 +301,7 @@ static void rna_Bone_layer_set(PointerRNA *ptr, const bool *values)
Bone *bone = (Bone *)ptr->data;
rna_bone_layer_set(&bone->layer, values);
BKE_armature_refresh_layer_used(arm);
BKE_armature_refresh_layer_used(NULL, arm);
}
/* TODO: remove the deprecation stubs. */

View File

@ -2516,7 +2516,7 @@ static void rna_def_fluid_flow_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_inflow", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", FLUID_FLOW_USE_INFLOW);
RNA_def_property_ui_text(prop, "Enabled", "Control when to apply inflow");
RNA_def_property_ui_text(prop, "Use Flow", "Control when to apply fluid flow");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_flow_reset");
prop = RNA_def_property(srna, "subframes", PROP_INT, PROP_NONE);

View File

@ -366,6 +366,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
copy_masked_polys_to_new_mesh(
*mesh, *result, vertex_map, edge_map, masked_poly_indices, new_loop_starts);
BKE_mesh_calc_edges_loose(result);
/* Tag to recalculate normals later. */
result->runtime.cd_dirty_vert |= CD_MASK_NORMAL;

View File

@ -311,8 +311,7 @@ static void cmp_node_rlayer_create_outputs(bNodeTree *ntree,
if ((scene->r.mode & R_EDGE_FRS) &&
(view_layer->freestyle_config.flags & FREESTYLE_AS_RENDER_PASS)) {
ntreeCompositRegisterPass(
scene->nodetree, scene, view_layer, RE_PASSNAME_FREESTYLE, SOCK_RGBA);
ntreeCompositRegisterPass(ntree, scene, view_layer, RE_PASSNAME_FREESTYLE, SOCK_RGBA);
}
MEM_freeN(data);

View File

@ -848,6 +848,7 @@ static void wm_draw_window(bContext *C, wmWindow *win)
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, GPU_texture_opengl_bindcode(texture));
wmWindowViewport(win);
if (win->stereo3d_format->display_mode == S3D_DISPLAY_SIDEBYSIDE) {
wm_stereo3d_draw_sidebyside(win, view);
}

View File

@ -959,7 +959,7 @@ static const char arg_handle_debug_mode_generic_set_doc_jobs[] =
"Enable time profiling for background jobs.";
static const char arg_handle_debug_mode_generic_set_doc_gpu[] =
"\n\t"
"Enable gpu debug context and information for OpenGL 4.3+.";
"Enable GPU debug context and information for OpenGL 4.3+.";
static const char arg_handle_debug_mode_generic_set_doc_depsgraph[] =
"\n\t"
"Enable all debug messages from dependency graph.";
@ -995,7 +995,7 @@ static int arg_handle_debug_mode_generic_set(int UNUSED(argc),
static const char arg_handle_debug_mode_io_doc[] =
"\n\t"
"Enable debug messages for I/O (collada, ...).";
"Enable debug messages for I/O (Collada, ...).";
static int arg_handle_debug_mode_io(int UNUSED(argc),
const char **UNUSED(argv),
void *UNUSED(data))
@ -1124,7 +1124,7 @@ static int arg_handle_factory_startup_set(int UNUSED(argc),
static const char arg_handle_disable_override_library_doc[] =
"\n\t"
"Enable Library Override features in the UI.";
"Disable Library Override features in the UI.";
static int arg_handle_disable_override_library(int UNUSED(argc),
const char **UNUSED(argv),
void *UNUSED(data))
@ -1497,7 +1497,7 @@ static int arg_handle_threads_set(int argc, const char **argv, void *UNUSED(data
static const char arg_handle_verbosity_set_doc[] =
"<verbose>\n"
"\tSet logging verbosity level for debug messages which supports it.";
"\tSet the logging verbosity level for debug messages that support it.";
static int arg_handle_verbosity_set(int argc, const char **argv, void *UNUSED(data))
{
const char *arg_id = "--verbose";