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>2017-10-26 13:40:37 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-10-26 14:02:40 +0300
commitef96f36ee961e7f11556570da2b9cef0a08159f9 (patch)
tree2a6943daee3d11baa7f3a92a58eff72d48ea3609 /source/blender/makesrna/intern/rna_space.c
parent654ee398ff0e37f4d5f5c4df96b1d521e4796de4 (diff)
Move background images into the camera
This moves background images out of the 3D viewport, to be used only as camera reference images. For 3D viewport references, background images can be used, see: D2827 Some work is still needed (background option isn't working at the moment).
Diffstat (limited to 'source/blender/makesrna/intern/rna_space.c')
-rw-r--r--source/blender/makesrna/intern/rna_space.c255
1 files changed, 0 insertions, 255 deletions
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 3e6328ec131..679ee1fe698 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -1463,59 +1463,6 @@ static void rna_Sequencer_view_type_update(Main *UNUSED(bmain), Scene *UNUSED(sc
ED_area_tag_refresh(sa);
}
-static float rna_BackgroundImage_opacity_get(PointerRNA *ptr)
-{
- BGpic *bgpic = (BGpic *)ptr->data;
- return 1.0f - bgpic->blend;
-}
-
-static void rna_BackgroundImage_opacity_set(PointerRNA *ptr, float value)
-{
- BGpic *bgpic = (BGpic *)ptr->data;
- bgpic->blend = 1.0f - value;
-}
-
-/* radius internally (expose as a distance value) */
-static float rna_BackgroundImage_size_get(PointerRNA *ptr)
-{
- BGpic *bgpic = ptr->data;
- return bgpic->size * 2.0f;
-}
-
-static void rna_BackgroundImage_size_set(PointerRNA *ptr, float value)
-{
- BGpic *bgpic = ptr->data;
- bgpic->size = value * 0.5f;
-}
-
-static BGpic *rna_BackgroundImage_new(View3D *v3d)
-{
- BGpic *bgpic = ED_view3D_background_image_new(v3d);
-
- WM_main_add_notifier(NC_SPACE | ND_SPACE_VIEW3D, v3d);
-
- return bgpic;
-}
-
-static void rna_BackgroundImage_remove(View3D *v3d, ReportList *reports, PointerRNA *bgpic_ptr)
-{
- BGpic *bgpic = bgpic_ptr->data;
- if (BLI_findindex(&v3d->bgpicbase, bgpic) == -1) {
- BKE_report(reports, RPT_ERROR, "Background image cannot be removed");
- }
-
- ED_view3D_background_image_remove(v3d, bgpic);
- RNA_POINTER_INVALIDATE(bgpic_ptr);
-
- WM_main_add_notifier(NC_SPACE | ND_SPACE_VIEW3D, v3d);
-}
-
-static void rna_BackgroundImage_clear(View3D *v3d)
-{
- ED_view3D_background_image_clear(v3d);
- WM_main_add_notifier(NC_SPACE | ND_SPACE_VIEW3D, v3d);
-}
-
/* Space Node Editor */
static void rna_SpaceNodeEditor_node_tree_set(PointerRNA *ptr, const PointerRNA value)
@@ -2206,194 +2153,6 @@ static void rna_def_space_outliner(BlenderRNA *brna)
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
}
-static void rna_def_background_image(BlenderRNA *brna)
-{
- StructRNA *srna;
- PropertyRNA *prop;
-
- /* note: combinations work but don't flip so arnt that useful */
- static const EnumPropertyItem bgpic_axis_items[] = {
- {0, "", 0, N_("X Axis"), ""},
- {(1 << RV3D_VIEW_LEFT), "LEFT", 0, "Left", "Show background image while looking to the left"},
- {(1 << RV3D_VIEW_RIGHT), "RIGHT", 0, "Right", "Show background image while looking to the right"},
- /*{(1<<RV3D_VIEW_LEFT)|(1<<RV3D_VIEW_RIGHT), "LEFT_RIGHT", 0, "Left/Right", ""},*/
- {0, "", 0, N_("Y Axis"), ""},
- {(1 << RV3D_VIEW_BACK), "BACK", 0, "Back", "Show background image in back view"},
- {(1 << RV3D_VIEW_FRONT), "FRONT", 0, "Front", "Show background image in front view"},
- /*{(1<<RV3D_VIEW_BACK)|(1<<RV3D_VIEW_FRONT), "BACK_FRONT", 0, "Back/Front", ""},*/
- {0, "", 0, N_("Z Axis"), ""},
- {(1 << RV3D_VIEW_BOTTOM), "BOTTOM", 0, "Bottom", "Show background image in bottom view"},
- {(1 << RV3D_VIEW_TOP), "TOP", 0, "Top", "Show background image in top view"},
- /*{(1<<RV3D_VIEW_BOTTOM)|(1<<RV3D_VIEW_TOP), "BOTTOM_TOP", 0, "Top/Bottom", ""},*/
- {0, "", 0, N_("Other"), ""},
- {0, "ALL", 0, "All Views", "Show background image in all views"},
- {(1 << RV3D_VIEW_CAMERA), "CAMERA", 0, "Camera", "Show background image in camera view"},
- {0, NULL, 0, NULL, NULL}
- };
-
- static const EnumPropertyItem bgpic_source_items[] = {
- {V3D_BGPIC_IMAGE, "IMAGE", 0, "Image", ""},
- {V3D_BGPIC_MOVIE, "MOVIE_CLIP", 0, "Movie Clip", ""},
- {0, NULL, 0, NULL, NULL}
- };
-
- static const EnumPropertyItem bgpic_camera_frame_items[] = {
- {0, "STRETCH", 0, "Stretch", ""},
- {V3D_BGPIC_CAMERA_ASPECT, "FIT", 0, "Fit", ""},
- {V3D_BGPIC_CAMERA_ASPECT | V3D_BGPIC_CAMERA_CROP, "CROP", 0, "Crop", ""},
- {0, NULL, 0, NULL, NULL}
- };
-
- static const EnumPropertyItem bgpic_draw_depth_items[] = {
- {0, "BACK", 0, "Back", ""},
- {V3D_BGPIC_FOREGROUND, "FRONT", 0, "Front", ""},
- {0, NULL, 0, NULL, NULL}
- };
-
- srna = RNA_def_struct(brna, "BackgroundImage", NULL);
- RNA_def_struct_sdna(srna, "BGpic");
- RNA_def_struct_ui_text(srna, "Background Image", "Image and settings for display in the 3D View background");
-
- prop = RNA_def_property(srna, "source", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "source");
- RNA_def_property_enum_items(prop, bgpic_source_items);
- RNA_def_property_ui_text(prop, "Background Source", "Data source used for background");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "ima");
- RNA_def_property_ui_text(prop, "Image", "Image displayed and edited in this space");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "clip");
- RNA_def_property_ui_text(prop, "MovieClip", "Movie clip displayed and edited in this space");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "iuser");
- RNA_def_property_ui_text(prop, "Image User",
- "Parameters defining which layer, pass and frame of the image is displayed");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "clip_user", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "MovieClipUser");
- RNA_def_property_pointer_sdna(prop, NULL, "cuser");
- RNA_def_property_ui_text(prop, "Clip User", "Parameters defining which frame of the movie clip is displayed");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "offset_x", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "xof");
- RNA_def_property_ui_text(prop, "X Offset", "Offset image horizontally from the world origin");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "offset_y", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "yof");
- RNA_def_property_ui_text(prop, "Y Offset", "Offset image vertically from the world origin");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "size");
- RNA_def_property_float_funcs(prop, "rna_BackgroundImage_size_get", "rna_BackgroundImage_size_set", NULL);
- RNA_def_property_ui_text(prop, "Size", "Size of the background image (ortho view only)");
- RNA_def_property_range(prop, 0.0, FLT_MAX);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_EULER);
- RNA_def_property_float_sdna(prop, NULL, "rotation");
- RNA_def_property_ui_text(prop, "Rotation", "Rotation for the background image (ortho view only)");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "use_flip_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_BGPIC_FLIP_X);
- RNA_def_property_ui_text(prop, "Flip Horizontally", "Flip the background image horizontally");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "use_flip_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_BGPIC_FLIP_Y);
- RNA_def_property_ui_text(prop, "Flip Vertically", "Flip the background image vertically");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "opacity", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "blend");
- RNA_def_property_float_funcs(prop, "rna_BackgroundImage_opacity_get", "rna_BackgroundImage_opacity_set", NULL);
- RNA_def_property_ui_text(prop, "Opacity", "Image opacity to blend the image against the background color");
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "view_axis", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "view");
- RNA_def_property_enum_items(prop, bgpic_axis_items);
- RNA_def_property_ui_text(prop, "Image Axis", "The axis to display the image on");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_BGPIC_EXPANDED);
- RNA_def_property_ui_text(prop, "Show Expanded", "Show the expanded in the user interface");
- RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
-
- prop = RNA_def_property(srna, "use_camera_clip", PROP_BOOLEAN, PROP_NONE);
- 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);
-
- prop = RNA_def_property(srna, "show_on_foreground", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_BGPIC_FOREGROUND);
- RNA_def_property_ui_text(prop, "Show On Foreground", "Show this image in front of objects in viewport");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- /* expose 1 flag as a enum of 2 items */
- prop = RNA_def_property(srna, "draw_depth", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, bgpic_draw_depth_items);
- RNA_def_property_ui_text(prop, "Depth", "Draw under or over everything");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- /* expose 2 flags as a enum of 3 items */
- prop = RNA_def_property(srna, "frame_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, bgpic_camera_frame_items);
- RNA_def_property_ui_text(prop, "Frame Method", "How the image fits in the camera frame");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-}
-
-static void rna_def_backgroundImages(BlenderRNA *brna, PropertyRNA *cprop)
-{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "BackgroundImages");
- srna = RNA_def_struct(brna, "BackgroundImages", NULL);
- RNA_def_struct_sdna(srna, "View3D");
- RNA_def_struct_ui_text(srna, "Background Images", "Collection of background images");
-
- func = RNA_def_function(srna, "new", "rna_BackgroundImage_new");
- RNA_def_function_ui_description(func, "Add new background image");
- parm = RNA_def_pointer(func, "image", "BackgroundImage", "", "Image displayed as viewport background");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_BackgroundImage_remove");
- RNA_def_function_ui_description(func, "Remove background image");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "image", "BackgroundImage", "", "Image displayed as viewport background");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
-
- func = RNA_def_function(srna, "clear", "rna_BackgroundImage_clear");
- RNA_def_function_ui_description(func, "Remove all background images");
-}
-
-
static void rna_def_space_view3d(BlenderRNA *brna)
{
StructRNA *srna;
@@ -2669,19 +2428,6 @@ static void rna_def_space_view3d(BlenderRNA *brna)
RNA_def_property_ui_icon(prop, ICON_ORTHO, 0);
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
- prop = RNA_def_property(srna, "background_images", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "bgpicbase", NULL);
- RNA_def_property_struct_type(prop, "BackgroundImage");
- RNA_def_property_ui_text(prop, "Background Images", "List of background images");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
- rna_def_backgroundImages(brna, prop);
-
- prop = RNA_def_property(srna, "show_background_images", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_DISPBGPICS);
- RNA_def_property_ui_text(prop, "Display Background Images",
- "Display reference images behind objects in the 3D View");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
prop = RNA_def_property(srna, "pivot_point", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "around");
RNA_def_property_enum_items(prop, pivot_items_full);
@@ -4852,7 +4598,6 @@ void RNA_def_space(BlenderRNA *brna)
rna_def_filemenu_entry(brna);
rna_def_space_filebrowser(brna);
rna_def_space_outliner(brna);
- rna_def_background_image(brna);
rna_def_space_view3d(brna);
rna_def_space_buttons(brna);
rna_def_space_dopesheet(brna);