diff options
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/rna_camera.c | 9 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 134 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 6 |
3 files changed, 145 insertions, 4 deletions
diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c index 5704004b4b6..31e991dd2b6 100644 --- a/source/blender/makesrna/intern/rna_camera.c +++ b/source/blender/makesrna/intern/rna_camera.c @@ -284,8 +284,6 @@ void RNA_def_camera(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Lens Unit", "Unit to edit lens in for the user interface"); /* pointers */ - rna_def_animdata_common(srna); - prop = RNA_def_property(srna, "dof_object", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "Object"); RNA_def_property_pointer_sdna(prop, NULL, "dof_ob"); @@ -293,6 +291,13 @@ void RNA_def_camera(BlenderRNA *brna) RNA_def_property_ui_text(prop, "DOF Object", "Use this object to define the depth of field focal point"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); + prop = RNA_def_property(srna, "gpu_dof", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "GPUDOFSettings"); + RNA_def_property_ui_text(prop, "GPU Depth Of Field", ""); + RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); + + rna_def_animdata_common(srna); + /* Camera API */ RNA_api_camera(srna); } diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 1c133db37b7..b3151d5a844 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1692,6 +1692,28 @@ static void rna_FreestyleSettings_module_remove(ID *id, FreestyleSettings *confi WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL); } +char *rna_GPUDOF_path(PointerRNA *ptr) +{ + /* if there is ID-data, resolve the path using the index instead of by name, + * since the name used is the name of the texture assigned, but the texture + * may be used multiple times in the same stack + */ + if (ptr->id.data) { + if (GS(((ID *)ptr->id.data)->name) == ID_CA) { + return BLI_strdup("gpu_dof"); + } + } + + return BLI_strdup("");; +} + +static void rna_GPUFXSettings_fx_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) +{ + GPUFXSettings *fx_settings = ptr->data; + + BKE_screen_gpu_fx_validate(fx_settings); +} + #else static void rna_def_transform_orientation(BlenderRNA *brna) @@ -3822,6 +3844,114 @@ static void rna_def_scene_game_data(BlenderRNA *brna) rna_def_scene_game_recast_data(brna); } +static void rna_def_gpu_dof_fx(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "GPUDOFSettings", NULL); + RNA_def_struct_ui_text(srna, "GPU DOF", "Settings for GPU based depth of field"); + RNA_def_struct_ui_icon(srna, ICON_RENDERLAYERS); + RNA_def_struct_path_func(srna, "rna_GPUDOF_path"); + + prop = RNA_def_property(srna, "focus_distance", PROP_FLOAT, PROP_DISTANCE); + RNA_def_property_ui_text(prop, "Focus distance", "Viewport depth of field focus distance"); + RNA_def_property_range(prop, 0.0f, FLT_MAX); + RNA_def_property_ui_range(prop, 0.0f, 5000.0f, 1, 2); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + + prop = RNA_def_property(srna, "focal_length", PROP_FLOAT, PROP_DISTANCE_CAMERA); + RNA_def_property_ui_text(prop, "Focal Length", "Foca Length for dof effect"); + RNA_def_property_range(prop, 1.0f, FLT_MAX); + RNA_def_property_ui_range(prop, 1.0f, 5000.0f, 1, 2); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + + prop = RNA_def_property(srna, "sensor", PROP_FLOAT, PROP_DISTANCE_CAMERA); + RNA_def_property_ui_text(prop, "Sensor", "Size of sensor"); + RNA_def_property_range(prop, 1.0f, FLT_MAX); + RNA_def_property_ui_range(prop, 1.0f, 5000.0f, 1, 2); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + + prop = RNA_def_property(srna, "fstop", PROP_FLOAT, PROP_NONE); + RNA_def_property_ui_text(prop, "F/Stop", "FStop for dof effect"); + RNA_def_property_range(prop, 0.0f, FLT_MAX); + RNA_def_property_ui_range(prop, 0.1f, 128.0f, 10, 1); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); +} + +static void rna_def_gpu_ssao_fx(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "GPUSSAOSettings", NULL); + RNA_def_struct_ui_text(srna, "GPU SSAO", "Settings for GPU based screen space ambient occlusion"); + RNA_def_struct_ui_icon(srna, ICON_RENDERLAYERS); + + prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE); + RNA_def_property_ui_text(prop, "Strength", "Strength of the ssao effect"); + RNA_def_property_range(prop, 0.0f, 250.0f); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + + prop = RNA_def_property(srna, "distance_max", PROP_FLOAT, PROP_NONE); + RNA_def_property_ui_text(prop, "Distance", "Distance of object that contribute to the SSAO effect"); + RNA_def_property_range(prop, 0.0f, 100000.0f); + RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + + prop = RNA_def_property(srna, "attenuation", PROP_FLOAT, PROP_NONE); + RNA_def_property_ui_text(prop, "Attenuation", "Attenuation constant"); + RNA_def_property_range(prop, 1.0f, 100000.0f); + RNA_def_property_ui_range(prop, 1.0f, 100.0f, 1, 3); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + + prop = RNA_def_property(srna, "samples", PROP_INT, PROP_NONE); + RNA_def_property_ui_text(prop, "Samples", "Number of samples. Final number is squared"); + RNA_def_property_range(prop, 1, 30); /* 0 is needed for compression. */ + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + + prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_ui_text(prop, "SSAO Color", "Color for screen space ambient occlusion effect"); + RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); +} + + +static void rna_def_gpu_fx(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + rna_def_gpu_ssao_fx(brna); + rna_def_gpu_dof_fx(brna); + + srna = RNA_def_struct(brna, "GPUFXSettings", NULL); + RNA_def_struct_ui_text(srna, "GPU FX Settings", "Settings for GPU based compositing"); + RNA_def_struct_ui_icon(srna, ICON_RENDERLAYERS); + + prop = RNA_def_property(srna, "dof", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); + RNA_def_property_struct_type(prop, "GPUDOFSettings"); + RNA_def_property_ui_text(prop, "Depth Of Field settings", ""); + + prop = RNA_def_property(srna, "use_dof", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "fx_flag", GPU_FX_FLAG_DOF); + RNA_def_property_ui_text(prop, "Depth Of Field", "Use depth of field on viewport using the values from active camera"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPUFXSettings_fx_update"); + + + prop = RNA_def_property(srna, "ssao", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); + RNA_def_property_struct_type(prop, "GPUSSAOSettings"); + RNA_def_property_ui_text(prop, "Screen Space Ambient Occlusion settings", ""); + + prop = RNA_def_property(srna, "use_ssao", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "fx_flag", GPU_FX_FLAG_SSAO); + RNA_def_property_ui_text(prop, "SSAO", "Use screen space ambient occlusion of field on viewport"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPUFXSettings_fx_update"); +} + + static void rna_def_scene_render_layer(BlenderRNA *brna) { StructRNA *srna; @@ -5862,7 +5992,9 @@ void RNA_def_scene(BlenderRNA *brna) /* *** Animated *** */ rna_def_scene_render_data(brna); rna_def_scene_render_layer(brna); - + + rna_def_gpu_fx(brna); + /* Scene API */ RNA_api_scene(srna); } diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 70b9f18df8c..24c80ccdb02 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -34,6 +34,7 @@ #include "BKE_key.h" #include "BKE_movieclip.h" #include "BKE_node.h" +#include "BKE_screen.h" #include "DNA_action_types.h" #include "DNA_key_types.h" @@ -2128,7 +2129,6 @@ static void rna_def_space_view3d(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - srna = RNA_def_struct(brna, "SpaceView3D", "Space"); RNA_def_struct_sdna(srna, "View3D"); RNA_def_struct_ui_text(srna, "3D View Space", "3D View space data"); @@ -2470,6 +2470,10 @@ static void rna_def_space_view3d(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Matcap", "Image to use for Material Capture, active objects only"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_SpaceView3D_matcap_update"); + prop = RNA_def_property(srna, "fx_settings", PROP_POINTER, PROP_NONE); + RNA_def_property_ui_text(prop, "FX Options", "Options used for real time compositing"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + /* region */ srna = RNA_def_struct(brna, "RegionView3D", NULL); |