3D View: empty image option to show front/back
Only back was possible.
This commit is contained in:
@@ -927,7 +927,7 @@ class LoadBackgroundImage(LoadImageAsEmpty, Operator):
|
|||||||
|
|
||||||
def set_settings(self, context, obj):
|
def set_settings(self, context, obj):
|
||||||
obj.empty_image_depth = 'BACK'
|
obj.empty_image_depth = 'BACK'
|
||||||
obj.show_empty_image_back = False
|
obj.empty_image_side = 'FRONT'
|
||||||
|
|
||||||
if context.space_data.type == 'VIEW_3D':
|
if context.space_data.type == 'VIEW_3D':
|
||||||
if not context.space_data.region_3d.is_perspective:
|
if not context.space_data.region_3d.is_perspective:
|
||||||
|
|||||||
@@ -56,9 +56,9 @@ class DATA_PT_empty(DataButtonsPanel, Panel):
|
|||||||
|
|
||||||
col = layout.column()
|
col = layout.column()
|
||||||
col.row().prop(ob, "empty_image_depth", text="Depth", expand=True)
|
col.row().prop(ob, "empty_image_depth", text="Depth", expand=True)
|
||||||
|
col.row().prop(ob, "empty_image_side", text="Side", expand=True)
|
||||||
col.prop(ob, "show_empty_image_orthographic", text="Display Orthographic")
|
col.prop(ob, "show_empty_image_orthographic", text="Display Orthographic")
|
||||||
col.prop(ob, "show_empty_image_perspective", text="Display Perspective")
|
col.prop(ob, "show_empty_image_perspective", text="Display Perspective")
|
||||||
col.prop(ob, "show_empty_image_back", text="Display Back")
|
|
||||||
|
|
||||||
|
|
||||||
classes = (
|
classes = (
|
||||||
|
|||||||
@@ -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;
|
char visibility_flag = ob->empty_image_visibility_flag;
|
||||||
|
|
||||||
if ((visibility_flag & OB_EMPTY_IMAGE_HIDE_BACK) != 0) {
|
if ((visibility_flag & (OB_EMPTY_IMAGE_HIDE_BACK | OB_EMPTY_IMAGE_HIDE_FRONT)) != 0) {
|
||||||
if (dot_v3v3((float *)&ob->obmat[2], (float *)&rv3d->viewinv[2]) < 0.0f) {
|
/* TODO: this isn't correct with perspective projection. */
|
||||||
return false;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -614,6 +614,7 @@ enum {
|
|||||||
OB_EMPTY_IMAGE_HIDE_PERSPECTIVE = 1 << 0,
|
OB_EMPTY_IMAGE_HIDE_PERSPECTIVE = 1 << 0,
|
||||||
OB_EMPTY_IMAGE_HIDE_ORTHOGRAPHIC = 1 << 1,
|
OB_EMPTY_IMAGE_HIDE_ORTHOGRAPHIC = 1 << 1,
|
||||||
OB_EMPTY_IMAGE_HIDE_BACK = 1 << 2,
|
OB_EMPTY_IMAGE_HIDE_BACK = 1 << 2,
|
||||||
|
OB_EMPTY_IMAGE_HIDE_FRONT = 1 << 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MAX_DUPLI_RECUR 8
|
#define MAX_DUPLI_RECUR 8
|
||||||
|
|||||||
@@ -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_ui_text(prop, "Display in Orthographic Mode", "Display image in orthographic mode");
|
||||||
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
|
||||||
|
|
||||||
prop = RNA_def_property(srna, "show_empty_image_back", PROP_BOOLEAN, PROP_NONE);
|
static EnumPropertyItem prop_empty_image_side_items[] = {
|
||||||
RNA_def_property_boolean_negative_sdna(prop, NULL, "empty_image_visibility_flag", OB_EMPTY_IMAGE_HIDE_BACK);
|
{0, "DOUBLE_SIDED", 0, "Both", ""},
|
||||||
RNA_def_property_ui_text(prop, "Display Back Side", "Display empty image even when viewed from the back");
|
{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);
|
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
|
||||||
|
|
||||||
/* render */
|
/* render */
|
||||||
|
|||||||
Reference in New Issue
Block a user