option to disable/enable individual background images
authorDalai Felinto <dfelinto@gmail.com>
Tue, 29 Nov 2011 21:05:18 +0000 (21:05 +0000)
committerDalai Felinto <dfelinto@gmail.com>
Tue, 29 Nov 2011 21:05:18 +0000 (21:05 +0000)
*** 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.

release/scripts/startup/bl_ui/space_view3d.py
source/blender/editors/space_view3d/view3d_draw.c
source/blender/makesdna/DNA_view3d_types.h
source/blender/makesrna/intern/rna_space.c

index 55437d63a5d3d4061966dce4833ddad80b549bd4..6ec28f24e76fe1223d52475e50bc3ae47de6f388 100644 (file)
@@ -2300,6 +2300,12 @@ class VIEW3D_PT_background_image(Panel):
                 row.prop(bg.clip, "name", text="", emboss=False)
             else:
                 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
 
             box.prop(bg, "view_axis", text="Axis")
index 5dfb9cfb5b6bc8cbeec7a67819d7ab2d14d96c8b..9899d2e5fa4876bec083ae2f990640a3a8c2f799 100644 (file)
@@ -1506,6 +1506,10 @@ static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d)
                        (bgpic->view & (1<<rv3d->view)) || /* check agaist flags */
                        (rv3d->persp==RV3D_CAMOB && bgpic->view == (1<<RV3D_VIEW_CAMERA))
                ) {
+                       /* disable individual images */
+                       if((bgpic->flag&V3D_BGPIC_DISABLED))
+                               continue;
+
                        freeibuf= NULL;
                        if(bgpic->source==V3D_BGPIC_IMAGE) {
                                ima= bgpic->ima;
index 93f4b209712449eebd5f2ec61f1fc4d68b6b297e..50136fdcc999dd8196472c30a01a93d5ed83cff2 100644 (file)
@@ -308,6 +308,7 @@ typedef struct View3D {
 /* may want to use 1 for select ?*/
 #define V3D_BGPIC_EXPANDED             2
 #define V3D_BGPIC_CAMERACLIP   4
+#define V3D_BGPIC_DISABLED             8
 
 /* BGPic->source */
 /* may want to use 1 for select ?*/
index 495a83f4bbee291ff7e2cf46c6f94f8602bfedf3..02eaddaecb635dbed9e0d4f61ff5818184522b23 100644 (file)
@@ -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_ui_text(prop, "Camera Clip", "Use movie clip from active scene camera");
        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)