Merge branch 'blender-v3.1-release'
This commit is contained in:
commit
7f68185d34
|
@ -339,8 +339,7 @@ int BKE_mesh_tessface_calc_ex(struct CustomData *fdata,
|
|||
struct MVert *mvert,
|
||||
int totface,
|
||||
int totloop,
|
||||
int totpoly,
|
||||
bool do_face_nor_copy);
|
||||
int totpoly);
|
||||
void BKE_mesh_tessface_calc(struct Mesh *mesh);
|
||||
|
||||
/**
|
||||
|
|
|
@ -1827,9 +1827,8 @@ Mesh *mesh_get_eval_final(struct Depsgraph *depsgraph,
|
|||
mesh_eval = BKE_object_get_evaluated_mesh(ob);
|
||||
}
|
||||
|
||||
if (mesh_eval != nullptr) {
|
||||
BLI_assert(!(mesh_eval->runtime.cd_dirty_vert & CD_MASK_NORMAL));
|
||||
}
|
||||
BKE_mesh_assert_normals_dirty_or_calculated(mesh_eval);
|
||||
|
||||
return mesh_eval;
|
||||
}
|
||||
|
||||
|
|
|
@ -1111,11 +1111,9 @@ Mesh *BKE_mesh_new_nomain_from_template_ex(const Mesh *me_src,
|
|||
|
||||
/* Ensure that when no normal layers exist, they are marked dirty, because
|
||||
* normals might not have been included in the mask of copied layers. */
|
||||
if (!CustomData_has_layer(&me_dst->vdata, CD_NORMAL)) {
|
||||
me_dst->runtime.cd_dirty_vert |= CD_MASK_NORMAL;
|
||||
}
|
||||
if (!CustomData_has_layer(&me_dst->pdata, CD_NORMAL)) {
|
||||
me_dst->runtime.cd_dirty_poly |= CD_MASK_NORMAL;
|
||||
if (!CustomData_has_layer(&me_dst->vdata, CD_NORMAL) ||
|
||||
!CustomData_has_layer(&me_dst->pdata, CD_NORMAL)) {
|
||||
BKE_mesh_normals_tag_dirty(me_dst);
|
||||
}
|
||||
|
||||
/* The destination mesh should at least have valid primary CD layers,
|
||||
|
|
|
@ -1486,11 +1486,9 @@ void BKE_mesh_nomain_to_mesh(Mesh *mesh_src,
|
|||
|
||||
/* Ensure that when no normal layers exist, they are marked dirty, because
|
||||
* normals might not have been included in the mask of copied layers. */
|
||||
if (!CustomData_has_layer(&tmp.vdata, CD_NORMAL)) {
|
||||
tmp.runtime.cd_dirty_vert |= CD_MASK_NORMAL;
|
||||
}
|
||||
if (!CustomData_has_layer(&tmp.pdata, CD_NORMAL)) {
|
||||
tmp.runtime.cd_dirty_poly |= CD_MASK_NORMAL;
|
||||
if (!CustomData_has_layer(&tmp.vdata, CD_NORMAL) ||
|
||||
!CustomData_has_layer(&tmp.pdata, CD_NORMAL)) {
|
||||
BKE_mesh_normals_tag_dirty(&tmp);
|
||||
}
|
||||
|
||||
if (CustomData_has_layer(&mesh_src->vdata, CD_SHAPEKEY)) {
|
||||
|
|
|
@ -144,8 +144,7 @@ int BKE_mesh_tessface_calc_ex(CustomData *fdata,
|
|||
MVert *mvert,
|
||||
int totface,
|
||||
int totloop,
|
||||
int totpoly,
|
||||
const bool do_face_nor_copy)
|
||||
int totpoly)
|
||||
{
|
||||
#define USE_TESSFACE_SPEEDUP
|
||||
#define USE_TESSFACE_QUADS
|
||||
|
@ -347,18 +346,6 @@ int BKE_mesh_tessface_calc_ex(CustomData *fdata,
|
|||
CustomData_add_layer(fdata, CD_ORIGINDEX, CD_ASSIGN, mface_to_poly_map, totface);
|
||||
CustomData_from_bmeshpoly(fdata, ldata, totface);
|
||||
|
||||
if (do_face_nor_copy) {
|
||||
/* If polys have a normals layer, copying that to faces can help
|
||||
* avoid the need to recalculate normals later. */
|
||||
if (CustomData_has_layer(pdata, CD_NORMAL)) {
|
||||
float(*pnors)[3] = CustomData_get_layer(pdata, CD_NORMAL);
|
||||
float(*fnors)[3] = CustomData_add_layer(fdata, CD_NORMAL, CD_CALLOC, NULL, totface);
|
||||
for (mface_index = 0; mface_index < totface; mface_index++) {
|
||||
copy_v3_v3(fnors[mface_index], pnors[mface_to_poly_map[mface_index]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* NOTE: quad detection issue - fourth vertidx vs fourth loopidx:
|
||||
* Polygons take care of their loops ordering, hence not of their vertices ordering.
|
||||
* Currently, our tfaces' fourth vertex index might be 0 even for a quad.
|
||||
|
@ -395,16 +382,13 @@ int BKE_mesh_tessface_calc_ex(CustomData *fdata,
|
|||
|
||||
void BKE_mesh_tessface_calc(Mesh *mesh)
|
||||
{
|
||||
mesh->totface = BKE_mesh_tessface_calc_ex(
|
||||
&mesh->fdata,
|
||||
&mesh->ldata,
|
||||
&mesh->pdata,
|
||||
mesh->mvert,
|
||||
mesh->totface,
|
||||
mesh->totloop,
|
||||
mesh->totpoly,
|
||||
/* Calculate normals right after, don't copy from polys here. */
|
||||
false);
|
||||
mesh->totface = BKE_mesh_tessface_calc_ex(&mesh->fdata,
|
||||
&mesh->ldata,
|
||||
&mesh->pdata,
|
||||
mesh->mvert,
|
||||
mesh->totface,
|
||||
mesh->totloop,
|
||||
mesh->totpoly);
|
||||
|
||||
BKE_mesh_update_customdata_pointers(mesh, true);
|
||||
}
|
||||
|
|
|
@ -2363,8 +2363,9 @@ void DepsgraphRelationBuilder::build_light(Light *lamp)
|
|||
/* light's nodetree */
|
||||
if (lamp->nodetree != nullptr) {
|
||||
build_nodetree(lamp->nodetree);
|
||||
ComponentKey nodetree_key(&lamp->nodetree->id, NodeType::NTREE_OUTPUT);
|
||||
add_relation(nodetree_key, shading_key, "NTree->Light Parameters");
|
||||
OperationKey ntree_key(
|
||||
&lamp->nodetree->id, NodeType::NTREE_OUTPUT, OperationCode::NTREE_OUTPUT);
|
||||
add_relation(ntree_key, shading_key, "NTree->Light Parameters");
|
||||
build_nested_nodetree(&lamp->id, lamp->nodetree);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -618,6 +618,12 @@ static void image_rect_update(void *rjv, RenderResult *rr, volatile rcti *renrec
|
|||
static void current_scene_update(void *rjv, Scene *scene)
|
||||
{
|
||||
RenderJob *rj = static_cast<RenderJob *>(rjv);
|
||||
|
||||
if (rj->current_scene != scene) {
|
||||
/* Image must be updated when rendered scene changes. */
|
||||
BKE_image_partial_update_mark_full_update(rj->image);
|
||||
}
|
||||
|
||||
rj->current_scene = scene;
|
||||
rj->iuser.scene = scene;
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ static uint16_t vbo_bind(const ShaderInterface *interface,
|
|||
const char *name = GPU_vertformat_attr_name_get(format, a, n_idx);
|
||||
const ShaderInput *input = interface->attr_get(name);
|
||||
|
||||
if (input == nullptr) {
|
||||
if (input == nullptr || input->location == -1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -371,7 +371,7 @@ static Mesh *arrayModifier_doArray(ArrayModifierData *amd,
|
|||
int tot_doubles;
|
||||
|
||||
const bool use_merge = (amd->flags & MOD_ARR_MERGE) != 0;
|
||||
const bool use_recalc_normals = (mesh->runtime.cd_dirty_vert & CD_MASK_NORMAL) || use_merge;
|
||||
const bool use_recalc_normals = BKE_mesh_vertex_normals_are_dirty(mesh) || use_merge;
|
||||
const bool use_offset_ob = ((amd->offset_type & MOD_ARR_OFF_OBJ) && amd->offset_ob != NULL);
|
||||
|
||||
int start_cap_nverts = 0, start_cap_nedges = 0, start_cap_npolys = 0, start_cap_nloops = 0;
|
||||
|
|
|
@ -313,8 +313,7 @@ static void displaceModifier_do(DisplaceModifierData *dmd,
|
|||
if (CustomData_has_layer(ldata, CD_CUSTOMLOOPNORMAL)) {
|
||||
float(*clnors)[3] = NULL;
|
||||
|
||||
if ((mesh->runtime.cd_dirty_vert & CD_MASK_NORMAL) ||
|
||||
!CustomData_has_layer(ldata, CD_NORMAL)) {
|
||||
if (!CustomData_has_layer(ldata, CD_NORMAL)) {
|
||||
BKE_mesh_calc_normals_split(mesh);
|
||||
}
|
||||
|
||||
|
|
|
@ -953,7 +953,7 @@ Mesh *MOD_solidify_extrude_modifyMesh(ModifierData *md, const ModifierEvalContex
|
|||
}
|
||||
|
||||
/* must recalculate normals with vgroups since they can displace unevenly T26888. */
|
||||
if ((mesh->runtime.cd_dirty_vert & CD_MASK_NORMAL) || do_rim || dvert) {
|
||||
if (BKE_mesh_vertex_normals_are_dirty(mesh) || do_rim || dvert) {
|
||||
BKE_mesh_normals_tag_dirty(result);
|
||||
}
|
||||
else if (do_shell) {
|
||||
|
@ -1009,9 +1009,9 @@ Mesh *MOD_solidify_extrude_modifyMesh(ModifierData *md, const ModifierEvalContex
|
|||
#define SOLIDIFY_SIDE_NORMALS
|
||||
|
||||
#ifdef SOLIDIFY_SIDE_NORMALS
|
||||
/* NOTE(@sybren): due to the code setting cd_dirty_vert a few lines above,
|
||||
/* NOTE(@sybren): due to the code setting normals dirty a few lines above,
|
||||
* do_side_normals is always false. */
|
||||
const bool do_side_normals = !(result->runtime.cd_dirty_vert & CD_MASK_NORMAL);
|
||||
const bool do_side_normals = !BKE_mesh_vertex_normals_are_dirty(result);
|
||||
/* annoying to allocate these since we only need the edge verts, */
|
||||
float(*edge_vert_nos)[3] = do_side_normals ?
|
||||
MEM_calloc_arrayN(numVerts, sizeof(float[3]), __func__) :
|
||||
|
|
|
@ -1106,6 +1106,8 @@ static void do_render_compositor_scenes(Render *re)
|
|||
return;
|
||||
}
|
||||
|
||||
bool changed_scene = false;
|
||||
|
||||
/* now foreach render-result node we do a full render */
|
||||
/* results are stored in a way compositor will find it */
|
||||
GSet *scenes_rendered = BLI_gset_ptr_new(__func__);
|
||||
|
@ -1118,11 +1120,20 @@ static void do_render_compositor_scenes(Render *re)
|
|||
do_render_compositor_scene(re, scene, cfra);
|
||||
BLI_gset_add(scenes_rendered, scene);
|
||||
node->typeinfo->updatefunc(restore_scene->nodetree, node);
|
||||
|
||||
if (scene != re->scene) {
|
||||
changed_scene = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
BLI_gset_free(scenes_rendered, NULL);
|
||||
|
||||
if (changed_scene) {
|
||||
/* If rendered another scene, switch back to the current scene with compositing nodes. */
|
||||
re->current_scene_update(re->suh, re->scene);
|
||||
}
|
||||
}
|
||||
|
||||
/* bad call... need to think over proper method still */
|
||||
|
|
Loading…
Reference in New Issue