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:
Diffstat (limited to 'source/blender/editors/render')
-rw-r--r--source/blender/editors/render/render_preview.c1
-rw-r--r--source/blender/editors/render/render_shading.c69
2 files changed, 18 insertions, 52 deletions
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c
index 007ae96ae59..b937f9a4104 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -64,6 +64,7 @@
#include "DNA_brush_types.h"
#include "DNA_screen_types.h"
+#include "BKE_brush.h"
#include "BKE_context.h"
#include "BKE_depsgraph.h"
#include "BKE_global.h"
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index fbdcf7ba9b3..1b24d660411 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -85,6 +85,8 @@
#include "UI_interface.h"
+#include "RE_pipeline.h"
+
#include "render_intern.h" // own include
/********************** material slot operators *********************/
@@ -661,60 +663,21 @@ void TEXTURE_OT_slot_move(wmOperatorType *ot)
/********************** environment map operators *********************/
-static int save_envmap(wmOperator *op, Scene *scene, EnvMap *env, char *str, int imtype)
+static int save_envmap(wmOperator *op, Scene *scene, EnvMap *env, char *path, int imtype)
{
- ImBuf *ibuf=NULL;
- int dx;
- int retval;
- int relative= (RNA_struct_find_property(op->ptr, "relative_path") && RNA_boolean_get(op->ptr, "relative_path"));
-
- if(env->cube[1]==NULL) {
- BKE_report(op->reports, RPT_ERROR, "There is no generated environment map available to save");
- return OPERATOR_CANCELLED;
- }
-
- dx= env->cube[1]->x;
-
- if (env->type == ENV_CUBE) {
- ibuf = IMB_allocImBuf(3*dx, 2*dx, 24, IB_rectfloat);
-
- IMB_rectcpy(ibuf, env->cube[0], 0, 0, 0, 0, dx, dx);
- IMB_rectcpy(ibuf, env->cube[1], dx, 0, 0, 0, dx, dx);
- IMB_rectcpy(ibuf, env->cube[2], 2*dx, 0, 0, 0, dx, dx);
- IMB_rectcpy(ibuf, env->cube[3], 0, dx, 0, 0, dx, dx);
- IMB_rectcpy(ibuf, env->cube[4], dx, dx, 0, 0, dx, dx);
- IMB_rectcpy(ibuf, env->cube[5], 2*dx, dx, 0, 0, dx, dx);
- }
- else if (env->type == ENV_PLANE) {
- ibuf = IMB_allocImBuf(dx, dx, 24, IB_rectfloat);
- IMB_rectcpy(ibuf, env->cube[1], 0, 0, 0, 0, dx, dx);
+ float layout[12];
+ if ( RNA_struct_find_property(op->ptr, "layout") )
+ RNA_float_get_array(op->ptr, "layout",layout);
+ else
+ memcpy(layout, default_envmap_layout, sizeof(layout));
+
+ if (RE_WriteEnvmapResult(op->reports, scene, env, path, imtype, layout)) {
+ return OPERATOR_FINISHED;
}
else {
- BKE_report(op->reports, RPT_ERROR, "Invalid environment map type");
return OPERATOR_CANCELLED;
}
-
- if (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT)
- ibuf->profile = IB_PROFILE_LINEAR_RGB;
-
- /* to save, we first get absolute path */
- BLI_path_abs(str, G.main->name);
-
- if (BKE_write_ibuf(ibuf, str, imtype, scene->r.subimtype, scene->r.quality)) {
- retval = OPERATOR_FINISHED;
- }
- else {
- BKE_reportf(op->reports, RPT_ERROR, "Error saving environment map to %s.", str);
- retval = OPERATOR_CANCELLED;
- }
- /* in case we were saving with relative paths, change back again */
- if(relative)
- BLI_path_rel(str, G.main->name);
-
- IMB_freeImBuf(ibuf);
- ibuf = NULL;
-
- return retval;
+
}
static int envmap_save_exec(bContext *C, wmOperator *op)
@@ -753,7 +716,6 @@ static int envmap_save_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event
return envmap_save_exec(C, op);
//RNA_enum_set(op->ptr, "file_type", scene->r.imtype);
-
RNA_string_set(op->ptr, "filepath", G.main->name);
WM_event_add_fileselect(C, op);
@@ -776,6 +738,7 @@ static int envmap_save_poll(bContext *C)
void TEXTURE_OT_envmap_save(wmOperatorType *ot)
{
+ PropertyRNA *prop;
/* identifiers */
ot->name= "Save Environment Map";
ot->idname= "TEXTURE_OT_envmap_save";
@@ -790,8 +753,10 @@ void TEXTURE_OT_envmap_save(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER; /* no undo since this doesnt modify the env-map */
/* properties */
- //RNA_def_enum(ot->srna, "file_type", image_file_type_items, R_PNG, "File Type", "File type to save image as.");
- WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH);
+ prop= RNA_def_float_array(ot->srna, "layout", 12, default_envmap_layout, 0.0f, 0.0f, "File layout", "Flat array describing the X,Y position of each cube face in the output image, where 1 is the size of a face. Order is [+Z -Z +Y -X -Y +X]. Use -1 to skip a face.", 0.0f, 0.0f);
+ RNA_def_property_flag(prop, PROP_HIDDEN);
+
+ WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH);
}
static int envmap_clear_exec(bContext *C, wmOperator *UNUSED(op))