Partial Fix T53269: Dupli-verts/dupli-faces not working

This fixes the issue for the Draw Manager, but for Cycles this is still not
working. The iterator bpy.context.depsgraph.duplis seems to be correct though.
This commit is contained in:
Dalai Felinto 2017-11-08 10:34:25 -02:00
parent da4bfb8770
commit 3750dfaa0a
Notes: blender-bot 2023-02-14 11:01:33 +01:00
Referenced by issue #53269, Dupli-verts/dupli-faces not working.
2 changed files with 7 additions and 6 deletions

View File

@ -75,6 +75,7 @@ typedef struct DupliContext {
Group *group; /* XXX child objects are selected from this group if set, could be nicer */
Scene *scene;
SceneLayer *scene_layer;
Object *object;
float space_mat[4][4];
@ -99,6 +100,7 @@ static void init_context(DupliContext *r_ctx, const EvaluationContext *eval_ctx,
{
r_ctx->eval_ctx = eval_ctx;
r_ctx->scene = scene;
r_ctx->scene_layer = eval_ctx->scene_layer;
/* don't allow BKE_object_handle_update for viewport during render, can crash */
r_ctx->do_update = update && !(G.is_rendering && eval_ctx->mode != DAG_EVAL_RENDER);
r_ctx->animated = false;
@ -255,13 +257,11 @@ static void make_child_duplis(const DupliContext *ctx, void *userdata, MakeChild
}
}
else {
unsigned int lay = ctx->scene->lay;
int baseid = 0;
BaseLegacy *base;
for (base = ctx->scene->base.first; base; base = base->next, baseid++) {
SceneLayer *scene_layer = ctx->scene_layer;
for (Base *base = scene_layer->object_bases.first; base; base = base->next, baseid++) {
Object *ob = base->object;
if ((base->lay & lay) && ob != obedit && is_child(ob, parent)) {
if ((base->flag & BASE_VISIBLED) && ob != obedit && is_child(ob, parent)) {
DupliContext pctx;
copy_dupli_context(&pctx, ctx, ctx->object, NULL, baseid, false);

View File

@ -134,7 +134,7 @@ static bool deg_flush_base_flags_and_settings(
{
Base *base;
Depsgraph *graph = data->graph;
SceneLayer *scene_layer = DEG_get_evaluated_scene_layer(graph);
SceneLayer *scene_layer = data->eval_ctx.scene_layer;
int flag = is_dupli ? BASE_FROMDUPLI : 0;
/* First attempt, see if object is in the current SceneLayer. */
@ -261,6 +261,7 @@ void DEG_objects_iterator_begin(BLI_Iterator *iter, DEGObjectsIteratorData *data
iter->data = data;
DEG_evaluation_context_init(&data->eval_ctx, DAG_EVAL_RENDER);
data->eval_ctx.scene_layer = DEG_get_evaluated_scene_layer(graph);
data->dupli_parent = NULL;
data->dupli_list = NULL;