[Bf-blender-cvs] [7409fdd] viewport_experiments: Cleanup naming, use sane defaults

Antony Riakiotakis noreply at git.blender.org
Thu Feb 12 16:40:24 CET 2015


Commit: 7409fddf272d8c97df4bb4d7093f1c0261f5617e
Author: Antony Riakiotakis
Date:   Thu Feb 12 14:54:45 2015 +0100
Branches: viewport_experiments
https://developer.blender.org/rB7409fddf272d8c97df4bb4d7093f1c0261f5617e

Cleanup naming, use sane defaults

===================================================================

M	release/scripts/startup/bl_ui/properties_data_camera.py
M	release/scripts/startup/bl_ui/space_view3d.py
M	source/blender/blenkernel/intern/camera.c
M	source/blender/blenkernel/intern/screen.c
M	source/blender/blenloader/intern/versioning_270.c
M	source/blender/editors/include/ED_view3d.h
M	source/blender/editors/space_view3d/view3d_draw.c
M	source/blender/gpu/GPU_compositing.h
M	source/blender/gpu/intern/gpu_compositing.c
M	source/blender/makesdna/DNA_gpu_types.h
M	source/blender/makesrna/intern/rna_scene.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/properties_data_camera.py b/release/scripts/startup/bl_ui/properties_data_camera.py
index 00428f0..7cbcc4c 100644
--- a/release/scripts/startup/bl_ui/properties_data_camera.py
+++ b/release/scripts/startup/bl_ui/properties_data_camera.py
@@ -203,9 +203,9 @@ class DATA_PT_camera_gpu_dof(Panel):
         dof_options = cam.gpu_dof
         col = layout.column(align=True)
         col.label("Focus object or distance is set in Depth Of Field Panel")
-        col.prop(dof_options, "dof_fstop")
-        col.prop(dof_options, "dof_focal_length")
-        col.prop(dof_options, "dof_sensor")
+        col.prop(dof_options, "fstop")
+        col.prop(dof_options, "focal_length")
+        col.prop(dof_options, "sensor")
 
     @classmethod
     def poll(cls, context):
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 2df075d..891278c 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -2943,20 +2943,20 @@ class VIEW3D_PT_view3d_shading(Panel):
                 else:
                     dof_options = fxoptions.dof_options
                     subcol = col.column(align=True)
-                    subcol.prop(dof_options, "dof_focus_distance")
-                    subcol.prop(dof_options, "dof_fstop")
-                    subcol.prop(dof_options, "dof_focal_length")
-                    subcol.prop(dof_options, "dof_sensor")
+                    subcol.prop(dof_options, "focus_distance")
+                    subcol.prop(dof_options, "fstop")
+                    subcol.prop(dof_options, "focal_length")
+                    subcol.prop(dof_options, "sensor")
 
             col.prop(view, "ssao")
             if view.ssao:
                 ssao_options = fxoptions.ssao_options
                 subcol = col.column(align=True)
-                subcol.prop(ssao_options, "ssao_darkening")
-                subcol.prop(ssao_options, "ssao_distance_max")
-                subcol.prop(ssao_options, "ssao_attenuation")
-                subcol.prop(ssao_options, "ssao_num_samples")
-                subcol.prop(ssao_options, "ssao_color")
+                subcol.prop(ssao_options, "darkening")
+                subcol.prop(ssao_options, "distance_max")
+                subcol.prop(ssao_options, "attenuation")
+                subcol.prop(ssao_options, "num_samples")
+                subcol.prop(ssao_options, "color")
 
 
 class VIEW3D_PT_view3d_motion_tracking(Panel):
diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c
index b59cdb6..b1ea339 100644
--- a/source/blender/blenkernel/intern/camera.c
+++ b/source/blender/blenkernel/intern/camera.c
@@ -67,6 +67,11 @@ void *BKE_camera_add(Main *bmain, const char *name)
 	cam->flag |= CAM_SHOWPASSEPARTOUT;
 	cam->passepartalpha = 0.5f;
 	
+	cam->gpu_dof.fstop = 128.0f;
+	cam->gpu_dof.focal_length = 1.0f;
+	cam->gpu_dof.focus_distance = 1.0f;
+	cam->gpu_dof.sensor = 1.0f;
+
 	return cam;
 }
 
@@ -694,10 +699,10 @@ void BKE_GPU_dof_from_camera(struct Object *camera, struct GPUFXOptions *options
 		if (cam->dof_ob) {
 			float vec[3];
 			sub_v3_v3v3(vec, cam->dof_ob->obmat[3], camera->obmat[3]);
-			options->dof_options->dof_focus_distance = len_v3(vec);
+			options->dof_options->focus_distance = len_v3(vec);
 		}
 		else {
-			options->dof_options->dof_focus_distance = cam->YF_dofdist;
+			options->dof_options->focus_distance = cam->YF_dofdist;
 		}
 	}
 }
diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c
index afda216..0ca8942 100644
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@ -599,10 +599,22 @@ float BKE_screen_view3d_zoom_from_fac(float zoomfac)
 	return ((sqrtf(4.0f * zoomfac) - (float)M_SQRT2) * 50.0f);
 }
 
-void BKE_screen_view3d_ensure_FX(View3D *v3d) {
+void BKE_screen_view3d_ensure_FX(View3D *v3d)
+{
 	if (!v3d->fxoptions) {
 		v3d->fxoptions = MEM_callocN(sizeof(GPUFXOptions), "view3d fx options");
 		v3d->fxoptions->dof_options = MEM_callocN(sizeof(GPUDOFOptions), "view3d dof options");
+
+		v3d->fxoptions->dof_options->fstop = 128.0f;
+		v3d->fxoptions->dof_options->focal_length = 1.0f;
+		v3d->fxoptions->dof_options->focus_distance = 1.0f;
+		v3d->fxoptions->dof_options->sensor = 1.0f;
+
 		v3d->fxoptions->ssao_options = MEM_callocN(sizeof(GPUSSAOOptions), "view3d ssao options");
+
+		v3d->fxoptions->ssao_options->darkening = 1.0f;
+		v3d->fxoptions->ssao_options->distance_max = 0.2f;
+		v3d->fxoptions->ssao_options->attenuation = 1.0f;
+		v3d->fxoptions->ssao_options->num_samples = 4;
 	}
 }
diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c
index 4ca1a44..2e5ab7f 100644
--- a/source/blender/blenloader/intern/versioning_270.c
+++ b/source/blender/blenloader/intern/versioning_270.c
@@ -35,6 +35,7 @@
 #define DNA_DEPRECATED_ALLOW
 
 #include "DNA_brush_types.h"
+#include "DNA_camera_types.h"
 #include "DNA_cloth_types.h"
 #include "DNA_constraint_types.h"
 #include "DNA_sdna_types.h"
@@ -560,5 +561,15 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
 			}
 			FOREACH_NODETREE_END
 		}
+
+		if (!DNA_struct_elem_find(fd->filesdna, "Camera", "GPUDOFOptions", "gpu_dof")) {
+			Camera *ca;
+			for (ca = main->camera.first; ca; ca = ca->id.next) {
+				ca->gpu_dof.fstop = 128.0f;
+				ca->gpu_dof.focal_length = 1.0f;
+				ca->gpu_dof.focus_distance = 1.0f;
+				ca->gpu_dof.sensor = 1.0f;
+			}
+		}
 	}
 }
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index cb8a3eb..114acee 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -64,7 +64,7 @@ struct wmWindow;
 struct GPUFX;
 struct GPUOffScreen;
 struct GPUFXOptions;
-enum GPUFxFlags;
+enum eGPUFxFlags;
 
 /* for derivedmesh drawing callbacks, for view3d_select, .... */
 typedef struct ViewContext {
@@ -308,7 +308,7 @@ int ED_view3d_scene_layer_set(int lay, const int *values, int *active);
 bool ED_view3d_context_activate(struct bContext *C);
 void ED_view3d_draw_offscreen_init(struct Scene *scene, struct View3D *v3d);
 void ED_view3d_draw_offscreen(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, int winx, int winy, float viewmat[4][4],
-                              float winmat[4][4], bool do_bgpic, bool do_sky, struct GPUFX *fx, bool is_persp, struct GPUOffScreen *ofs, struct GPUFXOptions *fxoptions, enum GPUFxFlags fxflags);
+                              float winmat[4][4], bool do_bgpic, bool do_sky, struct GPUFX *fx, bool is_persp, struct GPUOffScreen *ofs, struct GPUFXOptions *fxoptions, enum eGPUFxFlags fxflags);
 
 struct ImBuf *ED_view3d_draw_offscreen_imbuf(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, int sizex, int sizey, unsigned int flag,
                                              bool draw_background, int alpha_mode, char err_out[256]);
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 63890ba..e845625 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -3052,7 +3052,7 @@ static void view3d_main_area_clear(Scene *scene, View3D *v3d, ARegion *ar, bool
  */
 void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx, int winy,
                               float viewmat[4][4], float winmat[4][4],
-                              bool do_bgpic, bool do_sky, GPUFX *fx, bool is_persp, GPUOffScreen *ofs, GPUFXOptions *fxoptions, GPUFxFlags fxflags)
+                              bool do_bgpic, bool do_sky, GPUFX *fx, bool is_persp, GPUOffScreen *ofs, GPUFXOptions *fxoptions, eGPUFxFlags fxflags)
 {
 	struct bThemeState theme_state;
 	int bwinx, bwiny;
diff --git a/source/blender/gpu/GPU_compositing.h b/source/blender/gpu/GPU_compositing.h
index fe2bc5b..33dbd44 100644
--- a/source/blender/gpu/GPU_compositing.h
+++ b/source/blender/gpu/GPU_compositing.h
@@ -45,7 +45,7 @@ struct RegionView3D;
 struct rcti;
 struct Scene;
 struct View3D;
-enum GPUFXFlags;
+enum eGPUFXFlags;
 
 /**** Public API *****/
 
@@ -71,7 +71,7 @@ GPUFX *GPU_create_fx_compositor(void);
 void GPU_destroy_fx_compositor(GPUFX *fx);
 
 /* initialize a framebuffer with size taken from the viewport */
-bool GPU_initialize_fx_passes(GPUFX *fx, struct rcti *rect, rcti *scissor_rect, enum GPUFxFlags fxflags, struct GPUFXOptions *options);
+bool GPU_initialize_fx_passes(GPUFX *fx, struct rcti *rect, rcti *scissor_rect, enum eGPUFxFlags fxflags, struct GPUFXOptions *options);
 
 /* do compositing on the fx passes that have been initialized */
 bool GPU_fx_do_composite_pass(GPUFX *fx, float projmat[4][4], bool is_persp, struct Scene *scene, struct GPUOffScreen *ofs);
diff --git a/source/blender/gpu/intern/gpu_compositing.c b/source/blender/gpu/intern/gpu_compositing.c
index 87c4429..0fbe33f 100644
--- a/source/blender/gpu/intern/gpu_compositing.c
+++ b/source/blender/gpu/intern/gpu_compositing.c
@@ -253,7 +253,7 @@ static GPUTexture * create_jitter_texture(void)
 }
 
 
-bool GPU_initialize_fx_passes(GPUFX *fx, rcti *rect, rcti *scissor_rect, GPUFxFlags fxflags, GPUFXOptions *options)
+bool GPU_initialize_fx_passes(GPUFX *fx, rcti *rect, rcti *scissor_rect, eGPUFxFlags fxflags, GPUFXOptions *options)
 {
 	int w = BLI_rcti_size_x(rect) + 1, h = BLI_rcti_size_y(rect) + 1;
 	char err_out[256];
@@ -270,7 +270,7 @@ bool GPU_initialize_fx_passes(GPUFX *fx, rcti *rect, rcti *scissor_rect, GPUFxFl
 	if (!options->dof_options) {
 		fxflags &= ~GPU_FX_DEPTH_OF_FIELD;
 	}
-	if (!options->ssao_options || options->ssao_options->ssao_num_samples < 1) {
+	if (!options->ssao_options || options->ssao_options->num_samples < 1) {
 		fxflags &= ~GPU_FX_SSAO;
 	}
 
@@ -315,17 +315,17 @@ bool GPU_initialize_fx_passes(GPUFX *fx, rcti *rect, rcti *scissor_rect, GPUFxFl
 	}
 	
 	if (fxflags & GPU_FX_SSAO) {
-		if (options->ssao_options->ssao_num_samples != fx->ssao_sample_count || !fx->ssao_concentric_samples_tex) {
-			if (options->ssao_o

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list