option to disable/enable individual background images

*** use-case:
"I have 10 reference images that overlap each other and every time I want to see one, I need to change the transparency of all the others.
therefore it would be nice to have a little button by each menu to allow enable/disabling individual background images"

To avoid subversioning bump I created a define that is negative (DISABLED) and of course a rna that is a boolean_negative.
Talked with Campbell and he actually prefers this way over do_version, so there it goes.
This commit is contained in:
Dalai Felinto 2011-11-29 21:05:18 +00:00
parent 8bff756974
commit 5763e6ce85
4 changed files with 16 additions and 0 deletions

@ -2300,6 +2300,12 @@ class VIEW3D_PT_background_image(Panel):
row.prop(bg.clip, "name", text="", emboss=False) row.prop(bg.clip, "name", text="", emboss=False)
else: else:
row.label(text="Not Set") row.label(text="Not Set")
if bg.show_background_image:
row.prop(bg, "show_background_image", text="", emboss=False, icon='RESTRICT_VIEW_OFF')
else:
row.prop(bg, "show_background_image", text="", emboss=False, icon='RESTRICT_VIEW_ON')
row.operator("view3d.background_image_remove", text="", emboss=False, icon='X').index = i row.operator("view3d.background_image_remove", text="", emboss=False, icon='X').index = i
box.prop(bg, "view_axis", text="Axis") box.prop(bg, "view_axis", text="Axis")

@ -1506,6 +1506,10 @@ static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d)
(bgpic->view & (1<<rv3d->view)) || /* check agaist flags */ (bgpic->view & (1<<rv3d->view)) || /* check agaist flags */
(rv3d->persp==RV3D_CAMOB && bgpic->view == (1<<RV3D_VIEW_CAMERA)) (rv3d->persp==RV3D_CAMOB && bgpic->view == (1<<RV3D_VIEW_CAMERA))
) { ) {
/* disable individual images */
if((bgpic->flag&V3D_BGPIC_DISABLED))
continue;
freeibuf= NULL; freeibuf= NULL;
if(bgpic->source==V3D_BGPIC_IMAGE) { if(bgpic->source==V3D_BGPIC_IMAGE) {
ima= bgpic->ima; ima= bgpic->ima;

@ -308,6 +308,7 @@ typedef struct View3D {
/* may want to use 1 for select ?*/ /* may want to use 1 for select ?*/
#define V3D_BGPIC_EXPANDED 2 #define V3D_BGPIC_EXPANDED 2
#define V3D_BGPIC_CAMERACLIP 4 #define V3D_BGPIC_CAMERACLIP 4
#define V3D_BGPIC_DISABLED 8
/* BGPic->source */ /* BGPic->source */
/* may want to use 1 for select ?*/ /* may want to use 1 for select ?*/

@ -1311,6 +1311,11 @@ static void rna_def_background_image(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_BGPIC_CAMERACLIP); RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_BGPIC_CAMERACLIP);
RNA_def_property_ui_text(prop, "Camera Clip", "Use movie clip from active scene camera"); RNA_def_property_ui_text(prop, "Camera Clip", "Use movie clip from active scene camera");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
prop= RNA_def_property(srna, "show_background_image", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", V3D_BGPIC_DISABLED);
RNA_def_property_ui_text(prop, "Show Background Image", "Show this image as background");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
} }
static void rna_def_backgroundImages(BlenderRNA *brna, PropertyRNA *cprop) static void rna_def_backgroundImages(BlenderRNA *brna, PropertyRNA *cprop)