Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2018-11-26 17:23:16 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-11-26 23:25:33 +0300
commit408cdf0cbacb39a29934818dc6c656517f15a6a5 (patch)
tree91f06a53c348274b424d1f15078bcbbe7ae384a1 /source
parent15add11595fcefae604ec6980bcd840e3705232a (diff)
DRW: Add access to object dupli parent
Diffstat (limited to 'source')
-rw-r--r--source/blender/draw/intern/DRW_render.h3
-rw-r--r--source/blender/draw/intern/draw_manager.c46
-rw-r--r--source/blender/draw/intern/draw_manager.h2
3 files changed, 43 insertions, 8 deletions
diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h
index a5e08b4411c..1d11774d48f 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -516,6 +516,9 @@ bool DRW_object_use_hide_faces(const struct Object *ob);
bool DRW_object_is_visible_psys_in_active_context(const struct Object *object, const struct ParticleSystem *psys);
+struct Object *DRW_object_get_dupli_parent(const struct Object *ob);
+struct DupliObject *DRW_object_get_dupli(const struct Object *ob);
+
/* Draw commands */
void DRW_draw_pass(DRWPass *pass);
void DRW_draw_pass_subset(DRWPass *pass, DRWShadingGroup *start_group, DRWShadingGroup *end_group);
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index 94b3bbbd57d..9d0fb690b5a 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -234,6 +234,16 @@ bool DRW_object_is_visible_psys_in_active_context(
return true;
}
+struct Object *DRW_object_get_dupli_parent(const Object *UNUSED(ob))
+{
+ return DST.dupli_parent;
+}
+
+struct DupliObject *DRW_object_get_dupli(const Object *UNUSED(ob))
+{
+ return DST.dupli_source;
+}
+
/** \} */
@@ -1442,7 +1452,11 @@ void DRW_draw_render_loop_ex(
drw_engines_world_update(scene);
const int object_type_exclude_viewport = v3d->object_type_exclude_viewport;
- DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN(depsgraph, ob)
+ DEG_OBJECT_ITER_BEGIN(depsgraph, ob,
+ DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY |
+ DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET |
+ DEG_ITER_OBJECT_FLAG_VISIBLE |
+ DEG_ITER_OBJECT_FLAG_DUPLI)
{
if ((object_type_exclude_viewport & (1 << ob->type)) != 0) {
continue;
@@ -1450,9 +1464,11 @@ void DRW_draw_render_loop_ex(
if (v3d->localvd && ((v3d->local_view_uuid & ob->base_local_view_bits) == 0)) {
continue;
}
+ DST.dupli_parent = data_.dupli_parent;
+ DST.dupli_source = data_.dupli_object_current;
drw_engines_cache_populate(ob);
}
- DEG_OBJECT_ITER_FOR_RENDER_ENGINE_END;
+ DEG_OBJECT_ITER_END;
drw_engines_cache_finish();
@@ -1871,14 +1887,20 @@ void DRW_render_object_iter(
DRW_hair_init();
const int object_type_exclude_viewport = draw_ctx->v3d ? draw_ctx->v3d->object_type_exclude_viewport : 0;
- DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN(depsgraph, ob)
+ DEG_OBJECT_ITER_BEGIN(depsgraph, ob,
+ DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY |
+ DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET |
+ DEG_ITER_OBJECT_FLAG_VISIBLE |
+ DEG_ITER_OBJECT_FLAG_DUPLI)
{
if ((object_type_exclude_viewport & (1 << ob->type)) == 0) {
+ DST.dupli_parent = data_.dupli_parent;
+ DST.dupli_source = data_.dupli_object_current;
DST.ob_state = NULL;
callback(vedata, ob, engine, depsgraph);
}
}
- DEG_OBJECT_ITER_FOR_RENDER_ENGINE_END
+ DEG_OBJECT_ITER_END
}
/* Assume a valid gl context is bound (and that the gl_context_mutex has been acquired).
@@ -2076,9 +2098,9 @@ void DRW_draw_select_loop(
v3d->object_type_exclude_viewport | v3d->object_type_exclude_select
);
bool filter_exclude = false;
- DEG_OBJECT_ITER_BEGIN(
- depsgraph, ob,
+ DEG_OBJECT_ITER_BEGIN(depsgraph, ob,
DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY |
+ DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET |
DEG_ITER_OBJECT_FLAG_VISIBLE |
DEG_ITER_OBJECT_FLAG_DUPLI)
{
@@ -2106,6 +2128,8 @@ void DRW_draw_select_loop(
Object *ob_orig = DEG_get_original_object(ob);
DRW_select_load_id(ob_orig->select_color);
}
+ DST.dupli_parent = data_.dupli_parent;
+ DST.dupli_source = data_.dupli_object_current;
drw_engines_cache_populate(ob);
}
}
@@ -2261,7 +2285,11 @@ void DRW_draw_depth_loop(
drw_engines_world_update(scene);
const int object_type_exclude_viewport = v3d->object_type_exclude_viewport;
- DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN(depsgraph, ob)
+ DEG_OBJECT_ITER_BEGIN(depsgraph, ob,
+ DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY |
+ DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET |
+ DEG_ITER_OBJECT_FLAG_VISIBLE |
+ DEG_ITER_OBJECT_FLAG_DUPLI)
{
if ((object_type_exclude_viewport & (1 << ob->type)) != 0) {
continue;
@@ -2271,9 +2299,11 @@ void DRW_draw_depth_loop(
continue;
}
+ DST.dupli_parent = data_.dupli_parent;
+ DST.dupli_source = data_.dupli_object_current;
drw_engines_cache_populate(ob);
}
- DEG_OBJECT_ITER_FOR_RENDER_ENGINE_END;
+ DEG_OBJECT_ITER_END;
drw_engines_cache_finish();
diff --git a/source/blender/draw/intern/draw_manager.h b/source/blender/draw/intern/draw_manager.h
index c8a7816c402..07a8f5647a7 100644
--- a/source/blender/draw/intern/draw_manager.h
+++ b/source/blender/draw/intern/draw_manager.h
@@ -319,6 +319,8 @@ typedef struct DRWManager {
/* State of the object being evaluated if already allocated. */
DRWCallState *ob_state;
uchar state_cache_id; /* Could be larger but 254 view changes is already a lot! */
+ struct DupliObject *dupli_source;
+ struct Object *dupli_parent;
/* Rendering state */
GPUShader *shader;