Merge branch 'master' into blender2.8
[blender.git] / source / blender / makesrna / intern / rna_space.c
index c9f1b73966016d8b41f655b92e023bd7d7bab61f..0b8717fc982b4c5833a8dfeca300e501837c7602 100644 (file)
@@ -687,6 +687,15 @@ static int rna_SpaceView3D_viewport_shade_get(PointerRNA *ptr)
        return drawtype;
 }
 
+static void rna_SpaceView3D_viewport_shade_set(PointerRNA *ptr, int value)
+{
+       View3D *v3d = (View3D *)ptr->data;
+       if (value != v3d->drawtype && value == OB_RENDER) {
+               v3d->prev_drawtype = v3d->drawtype;
+       }
+       v3d->drawtype = value;
+}
+
 static EnumPropertyItem *rna_SpaceView3D_viewport_shade_itemf(bContext *UNUSED(C), PointerRNA *ptr,
                                                               PropertyRNA *UNUSED(prop), bool *r_free)
 {
@@ -2402,7 +2411,7 @@ static void rna_def_space_view3d(BlenderRNA *brna)
        prop = RNA_def_property(srna, "viewport_shade", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "drawtype");
        RNA_def_property_enum_items(prop, rna_enum_viewport_shade_items);
-       RNA_def_property_enum_funcs(prop, "rna_SpaceView3D_viewport_shade_get", NULL,
+       RNA_def_property_enum_funcs(prop, "rna_SpaceView3D_viewport_shade_get", "rna_SpaceView3D_viewport_shade_set",
                                    "rna_SpaceView3D_viewport_shade_itemf");
        RNA_def_property_ui_text(prop, "Viewport Shading", "Method to display/shade objects in the 3D View");
        RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_SpaceView3D_viewport_shade_update");