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:
authorCampbell Barton <ideasman42@gmail.com>2018-12-17 06:49:16 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-12-17 06:49:16 +0300
commit21c1c3c59c2309512293619cc58f9fe5a1edef2e (patch)
tree9c82e77882597a1be457a4c0dedaedddd9ad9704 /source/blender
parent365ef098155fddbdcf0beac60c171bd9e486c747 (diff)
3D View: empty image option to show front/back
Only back was possible.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/object.c15
-rw-r--r--source/blender/makesdna/DNA_object_types.h1
-rw-r--r--source/blender/makesrna/intern/rna_object.c13
3 files changed, 23 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 56843899ff6..498658765b6 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -2672,9 +2672,18 @@ bool BKE_object_empty_image_is_visible_in_view3d(const Object *ob, const RegionV
{
char visibility_flag = ob->empty_image_visibility_flag;
- if ((visibility_flag & OB_EMPTY_IMAGE_HIDE_BACK) != 0) {
- if (dot_v3v3((float *)&ob->obmat[2], (float *)&rv3d->viewinv[2]) < 0.0f) {
- return false;
+ if ((visibility_flag & (OB_EMPTY_IMAGE_HIDE_BACK | OB_EMPTY_IMAGE_HIDE_FRONT)) != 0) {
+ /* TODO: this isn't correct with perspective projection. */
+ const float dot = dot_v3v3((float *)&ob->obmat[2], (float *)&rv3d->viewinv[2]);
+ if (visibility_flag & OB_EMPTY_IMAGE_HIDE_BACK) {
+ if (dot < 0.0f) {
+ return false;
+ }
+ }
+ if (visibility_flag & OB_EMPTY_IMAGE_HIDE_FRONT) {
+ if (dot > 0.0f) {
+ return false;
+ }
}
}
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index 16ca673c83b..606cbe66d0d 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -614,6 +614,7 @@ enum {
OB_EMPTY_IMAGE_HIDE_PERSPECTIVE = 1 << 0,
OB_EMPTY_IMAGE_HIDE_ORTHOGRAPHIC = 1 << 1,
OB_EMPTY_IMAGE_HIDE_BACK = 1 << 2,
+ OB_EMPTY_IMAGE_HIDE_FRONT = 1 << 3,
};
#define MAX_DUPLI_RECUR 8
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 7fde114ca54..411c6af5a3f 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -2511,9 +2511,16 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Display in Orthographic Mode", "Display image in orthographic mode");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
- prop = RNA_def_property(srna, "show_empty_image_back", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "empty_image_visibility_flag", OB_EMPTY_IMAGE_HIDE_BACK);
- RNA_def_property_ui_text(prop, "Display Back Side", "Display empty image even when viewed from the back");
+ static EnumPropertyItem prop_empty_image_side_items[] = {
+ {0, "DOUBLE_SIDED", 0, "Both", ""},
+ {OB_EMPTY_IMAGE_HIDE_BACK, "FRONT", 0, "Front", ""},
+ {OB_EMPTY_IMAGE_HIDE_FRONT, "BACK", 0, "Back", ""},
+ {0, NULL, 0, NULL, NULL}
+ };
+ prop = RNA_def_property(srna, "empty_image_side", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "empty_image_visibility_flag");
+ RNA_def_property_enum_items(prop, prop_empty_image_side_items);
+ RNA_def_property_ui_text(prop, "Empty Image Side", "Show front/back side");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
/* render */