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
diff options
context:
space:
mode:
-rw-r--r--source/blender/blenkernel/BKE_object.h3
-rw-r--r--source/blender/blenkernel/intern/object.c25
-rw-r--r--source/blender/draw/modes/object_mode.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_empty.c2
4 files changed, 22 insertions, 12 deletions
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index 32bc2f03b9e..9cd98232375 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -349,7 +349,8 @@ bool BKE_object_modifier_update_subframe(
void BKE_object_type_set_empty_for_versioning(struct Object *ob);
-bool BKE_object_empty_image_is_visible_in_view3d(const struct Object *ob, const struct RegionView3D *rv3d);
+bool BKE_object_empty_image_frame_is_visible_in_view3d(const struct Object *ob, const struct RegionView3D *rv3d);
+bool BKE_object_empty_image_data_is_visible_in_view3d(const struct Object *ob, const struct RegionView3D *rv3d);
#ifdef __cplusplus
}
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index ca82353a16a..1743060aa97 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -2849,9 +2849,23 @@ void BKE_object_empty_draw_type_set(Object *ob, const int value)
}
}
-bool BKE_object_empty_image_is_visible_in_view3d(const Object *ob, const RegionView3D *rv3d)
+bool BKE_object_empty_image_frame_is_visible_in_view3d(const Object *ob, const RegionView3D *rv3d)
{
- char visibility_flag = ob->empty_image_visibility_flag;
+ const char visibility_flag = ob->empty_image_visibility_flag;
+ if (rv3d->is_persp) {
+ return (visibility_flag & OB_EMPTY_IMAGE_HIDE_PERSPECTIVE) == 0;
+ }
+ else {
+ return (visibility_flag & OB_EMPTY_IMAGE_HIDE_ORTHOGRAPHIC) == 0;
+ }
+}
+
+bool BKE_object_empty_image_data_is_visible_in_view3d(const Object *ob, const RegionView3D *rv3d)
+{
+ /* Caller is expected to check this. */
+ BLI_assert(BKE_object_empty_image_frame_is_visible_in_view3d(ob, rv3d));
+
+ const char visibility_flag = ob->empty_image_visibility_flag;
if ((visibility_flag & (OB_EMPTY_IMAGE_HIDE_BACK | OB_EMPTY_IMAGE_HIDE_FRONT)) != 0) {
float eps, dot;
@@ -2880,12 +2894,7 @@ bool BKE_object_empty_image_is_visible_in_view3d(const Object *ob, const RegionV
}
}
- if (rv3d->is_persp) {
- return (visibility_flag & OB_EMPTY_IMAGE_HIDE_PERSPECTIVE) == 0;
- }
- else {
- return (visibility_flag & OB_EMPTY_IMAGE_HIDE_ORTHOGRAPHIC) == 0;
- }
+ return true;
}
bool BKE_object_minmax_dupli(Depsgraph *depsgraph, Scene *scene, Object *ob, float r_min[3], float r_max[3], const bool use_hidden)
diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c
index 126e5da4b83..f68be196f0e 100644
--- a/source/blender/draw/modes/object_mode.c
+++ b/source/blender/draw/modes/object_mode.c
@@ -919,7 +919,7 @@ static void DRW_shgroup_empty_image(
{
/* TODO: 'StereoViews', see draw_empty_image. */
- if (!BKE_object_empty_image_is_visible_in_view3d(ob, rv3d)) {
+ if (!BKE_object_empty_image_frame_is_visible_in_view3d(ob, rv3d)) {
return;
}
@@ -945,7 +945,7 @@ static void DRW_shgroup_empty_image(
/* OPTI(fclem) We need sorting only for transparent images. If an image as no alpha channel and
* ob->col[3] == 1.0f, we could remove it from the sorting pass. */
- if (tex && (ob->color[3] > 0.0f)) {
+ if (tex && (ob->color[3] > 0.0f) && BKE_object_empty_image_data_is_visible_in_view3d(ob, rv3d)) {
DRWShadingGroup *grp = DRW_shgroup_create(sh_data->object_empty_image, sgl->image_empties);
DRW_shgroup_uniform_texture(grp, "image", tex);
/* TODO(fclem) implement DRW_shgroup_uniform_vec2_copy */
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_empty.c b/source/blender/editors/space_view3d/view3d_gizmo_empty.c
index ee6dd2b8267..7d6ec3b782f 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_empty.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_empty.c
@@ -118,7 +118,7 @@ static bool WIDGETGROUP_empty_image_poll(const bContext *C, wmGizmoGroupType *UN
Object *ob = base->object;
if (ob->type == OB_EMPTY) {
if (ob->empty_drawtype == OB_EMPTY_IMAGE) {
- return BKE_object_empty_image_is_visible_in_view3d(ob, rv3d);
+ return BKE_object_empty_image_frame_is_visible_in_view3d(ob, rv3d);
}
}
}