Merge remote-tracking branch 'origin/blender-v2.82-release'

This commit is contained in:
2020-01-28 18:24:17 +01:00
10 changed files with 60 additions and 11 deletions

View File

@@ -1385,6 +1385,8 @@ void DepsgraphRelationBuilder::build_animation_images(ID *id)
/* TODO: can we check for existence of node for performance? */
if (BKE_image_user_id_has_animation(id)) {
OperationKey image_animation_key(id, NodeType::ANIMATION, OperationCode::IMAGE_ANIMATION);
ComponentKey cow_key(id, NodeType::COPY_ON_WRITE);
add_relation(cow_key, image_animation_key, "CoW -> Image Animation");
TimeSourceKey time_src_key;
add_relation(time_src_key, image_animation_key, "TimeSrc -> Image Animation");
}
@@ -2370,12 +2372,16 @@ void DepsgraphRelationBuilder::build_cachefile(CacheFile *cache_file)
/* Animation. */
build_animdata(&cache_file->id);
build_parameters(&cache_file->id);
if (check_id_has_anim_component(&cache_file->id) ||
check_id_has_driver_component(&cache_file->id)) {
ComponentKey animation_key(&cache_file->id, NodeType::PARAMETERS);
if (check_id_has_anim_component(&cache_file->id)) {
ComponentKey animation_key(&cache_file->id, NodeType::ANIMATION);
ComponentKey datablock_key(&cache_file->id, NodeType::CACHE);
add_relation(animation_key, datablock_key, "Datablock Animation");
}
if (check_id_has_driver_component(&cache_file->id)) {
ComponentKey animation_key(&cache_file->id, NodeType::PARAMETERS);
ComponentKey datablock_key(&cache_file->id, NodeType::CACHE);
add_relation(animation_key, datablock_key, "Drivers -> Cache Eval");
}
/* Cache file updates */
if (cache_file->is_sequence) {

View File

@@ -1457,7 +1457,7 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata,
/* First get materials for this mesh. */
if (ELEM(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL)) {
const int materials_len = MAX2(1, ob->totcol);
const int materials_len = DRW_cache_object_material_count_get(ob);
struct DRWShadingGroup **shgrp_array = BLI_array_alloca(shgrp_array, materials_len);
struct DRWShadingGroup **shgrp_depth_array = BLI_array_alloca(shgrp_depth_array,

View File

@@ -962,7 +962,7 @@ static void workbench_cache_populate_texture_paint_mode(WORKBENCH_Data *vedata,
}
else {
/* IMAGEPAINT_MODE_MATERIAL */
const int materials_len = MAX2(1, ob->totcol);
const int materials_len = DRW_cache_object_material_count_get(ob);
struct GPUBatch **geom_array = DRW_cache_mesh_surface_texpaint_get(ob);
for (int i = 0; i < materials_len; i++) {
if (geom_array != NULL && geom_array[i] != NULL) {
@@ -1034,7 +1034,7 @@ void workbench_deferred_solid_cache_populate(WORKBENCH_Data *vedata, Object *ob)
const bool use_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->v3d) &&
!DRW_state_is_image_render();
const bool use_hide = is_active && DRW_object_use_hide_faces(ob);
const int materials_len = MAX2(1, ob->totcol);
const int materials_len = DRW_cache_object_material_count_get(ob);
const Mesh *me = (ob->type == OB_MESH) ? ob->data : NULL;
bool has_transp_mat = false;
const WORKBENCH_ColorOverride color_override = workbench_object_color_override_get(ob);

View File

@@ -594,7 +594,7 @@ static void workbench_forward_cache_populate_texture_paint_mode(WORKBENCH_Data *
}
else {
/* IMAGEPAINT_MODE_MATERIAL */
const int materials_len = MAX2(1, ob->totcol);
const int materials_len = DRW_cache_object_material_count_get(ob);
struct GPUBatch **geom_array = DRW_cache_mesh_surface_texpaint_get(ob);
for (int i = 0; i < materials_len; i++) {
if (geom_array != NULL && geom_array[i] != NULL) {
@@ -668,7 +668,7 @@ void workbench_forward_cache_populate(WORKBENCH_Data *vedata, Object *ob)
if (ELEM(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL)) {
const bool use_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->v3d) &&
!DRW_state_is_image_render();
const int materials_len = MAX2(1, ob->totcol);
const int materials_len = DRW_cache_object_material_count_get(ob);
const Mesh *me = (ob->type == OB_MESH) ? ob->data : NULL;
const WORKBENCH_ColorOverride color_override = workbench_object_color_override_get(ob);
const bool use_texture_paint_drawing = !(DRW_state_is_image_render() &&

View File

@@ -824,6 +824,25 @@ GPUBatch *DRW_cache_object_surface_get(Object *ob)
}
}
int DRW_cache_object_material_count_get(struct Object *ob)
{
short type = (ob->runtime.mesh_eval != NULL) ? OB_MESH : ob->type;
switch (type) {
case OB_MESH:
return DRW_mesh_material_count_get(ob->data);
case OB_CURVE:
case OB_SURF:
case OB_FONT:
return DRW_curve_material_count_get(ob->data);
case OB_MBALL:
return DRW_metaball_material_count_get(ob->data);
default:
BLI_assert(0);
return 0;
}
}
GPUBatch **DRW_cache_object_surface_material_get(struct Object *ob,
struct GPUMaterial **gpumat_array,
uint gpumat_array_len)

View File

@@ -56,6 +56,7 @@ struct GPUBatch **DRW_cache_object_surface_material_get(struct Object *ob,
struct GPUMaterial **gpumat_array,
uint gpumat_array_len);
struct GPUBatch *DRW_cache_object_face_wireframe_get(struct Object *ob);
int DRW_cache_object_material_count_get(struct Object *ob);
/* Empties */
struct GPUBatch *DRW_cache_plain_axes_get(void);
@@ -132,8 +133,6 @@ struct GPUBatch *DRW_cache_mesh_surface_weights_get(struct Object *ob);
struct GPUBatch *DRW_cache_mesh_surface_mesh_analysis_get(struct Object *ob);
struct GPUBatch *DRW_cache_mesh_face_wireframe_get(struct Object *ob);
void DRW_cache_mesh_sculpt_coords_ensure(struct Object *ob);
/* Curve */
struct GPUBatch *DRW_cache_curve_surface_get(struct Object *ob);
struct GPUBatch **DRW_cache_curve_surface_shaded_get(struct Object *ob,

View File

@@ -69,6 +69,8 @@ void DRW_mesh_batch_cache_free_old(struct Mesh *me, int ctime);
/* Curve */
void DRW_curve_batch_cache_create_requested(struct Object *ob);
int DRW_curve_material_count_get(struct Curve *cu);
struct GPUBatch *DRW_curve_batch_cache_get_wire_edge(struct Curve *cu);
struct GPUBatch *DRW_curve_batch_cache_get_normal_edge(struct Curve *cu);
struct GPUBatch *DRW_curve_batch_cache_get_edge_detection(struct Curve *cu, bool *r_is_manifold);
@@ -80,7 +82,10 @@ struct GPUBatch **DRW_curve_batch_cache_get_surface_shaded(struct Curve *cu,
struct GPUMaterial **gpumat_array,
uint gpumat_array_len);
struct GPUBatch *DRW_curve_batch_cache_get_wireframes_face(struct Curve *cu);
/* Metaball */
int DRW_metaball_material_count_get(struct MetaBall *mb);
struct GPUBatch *DRW_metaball_batch_cache_get_triangles_with_normals(struct Object *ob);
struct GPUBatch **DRW_metaball_batch_cache_get_surface_shaded(struct Object *ob,
struct MetaBall *mb,
@@ -160,6 +165,8 @@ struct GPUBatch *DRW_mesh_batch_cache_get_edituv_facedots(struct Mesh *me);
struct GPUBatch *DRW_mesh_batch_cache_get_uv_edges(struct Mesh *me);
struct GPUBatch *DRW_mesh_batch_cache_get_edit_mesh_analysis(struct Mesh *me);
int DRW_mesh_material_count_get(struct Mesh *me);
/* Edit mesh bitflags (is this the right place?) */
enum {
VFLAG_VERT_ACTIVE = 1 << 0,

View File

@@ -414,7 +414,7 @@ static bool curve_batch_cache_valid(Curve *cu)
return false;
}
if (cache->mat_len != max_ii(1, cu->totcol)) {
if (cache->mat_len != DRW_curve_material_count_get(cu)) {
return false;
}
@@ -914,6 +914,11 @@ GPUBatch *DRW_curve_batch_cache_get_edge_detection(Curve *cu, bool *r_is_manifol
return DRW_batch_request(&cache->batch.edge_detection);
}
int DRW_curve_material_count_get(Curve *cu)
{
return max_ii(1, cu->totcol);
}
/** \} */
/* -------------------------------------------------------------------- */

View File

@@ -751,6 +751,11 @@ GPUBatch *DRW_mesh_batch_cache_get_surface_vertpaint(Mesh *me)
return DRW_batch_request(&cache->batch.surface);
}
int DRW_mesh_material_count_get(Mesh *me)
{
return mesh_render_mat_len_get(me);
}
/** \} */
/* ---------------------------------------------------------------------- */

View File

@@ -25,6 +25,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_math_base.h"
#include "BLI_utildefines.h"
#include "DNA_meta_types.h"
@@ -206,6 +207,8 @@ GPUBatch **DRW_metaball_batch_cache_get_surface_shaded(Object *ob,
return NULL;
}
BLI_assert(gpumat_array_len == DRW_metaball_material_count_get(mb));
MetaBallBatchCache *cache = metaball_batch_cache_get(mb);
if (cache->shaded_triangles == NULL) {
cache->mat_len = gpumat_array_len;
@@ -270,3 +273,8 @@ struct GPUBatch *DRW_metaball_batch_cache_get_edge_detection(struct Object *ob,
return cache->edge_detection;
}
int DRW_metaball_material_count_get(MetaBall *mb)
{
return max_ii(1, mb->totcol);
}