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:
authorMatt Ebb <matt@mke3.net>2010-03-11 10:43:49 +0300
committerMatt Ebb <matt@mke3.net>2010-03-11 10:43:49 +0300
commit69a7060678e96b53548a14f22a83510f4d9edcd0 (patch)
treefb71d769da6be215a184099a7e059f431066982c
parent5ec57e80b059be1989bcf4df3ab9f235669f34cc (diff)
Restored Environment maps
* Fixed up RNA and UI * Brought back 'Save' and 'Clear' operators (in the little triangle menu in environment map properties) * While I was at it, noticed that environment maps were only using 8bit colour, changed it to use full 32bit float instead for proper HDR colour etc, so environment map reflections have the correct colour range --> http://mke3.net/blender/devel/2.5/env_hdr.jpg This fixes [#20904] Environment Map does not render; also missing panel
-rw-r--r--release/scripts/ui/properties_texture.py84
-rw-r--r--source/blender/blenkernel/intern/texture.c9
-rw-r--r--source/blender/editors/render/render_intern.h3
-rw-r--r--source/blender/editors/render/render_ops.c3
-rw-r--r--source/blender/editors/render/render_shading.c198
-rw-r--r--source/blender/editors/space_file/writeimage.c26
-rw-r--r--source/blender/makesrna/intern/rna_texture.c158
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c4
-rw-r--r--source/blender/render/intern/source/envmap.c17
9 files changed, 374 insertions, 128 deletions
diff --git a/release/scripts/ui/properties_texture.py b/release/scripts/ui/properties_texture.py
index 3b67cd3e0c0..4cdd404a405 100644
--- a/release/scripts/ui/properties_texture.py
+++ b/release/scripts/ui/properties_texture.py
@@ -33,6 +33,17 @@ class TEXTURE_MT_specials(bpy.types.Menu):
layout.operator("material.mtex_paste", icon='PASTEDOWN')
+class TEXTURE_MT_envmap_specials(bpy.types.Menu):
+ bl_label = "Environment Map Specials"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("texture.envmap_save", icon='IMAGEFILE')
+ layout.operator("texture.envmap_clear", icon='FILE_REFRESH')
+ layout.operator("texture.envmap_clear_all", icon='FILE_REFRESH')
+
+
def active_node_mat(mat):
if mat:
mat_node = mat.active_node_material
@@ -587,6 +598,19 @@ class TEXTURE_PT_image(TextureTypePanel):
layout.template_image(tex, "image", tex.image_user)
+def texture_filter_common(tex, layout):
+
+ layout.label(text="Filter:")
+ layout.prop(tex, "filter", text="")
+ if tex.mipmap and tex.filter in ('AREA', 'EWA', 'FELINE'):
+ if tex.filter == 'FELINE':
+ layout.prop(tex, "filter_probes", text="Probes")
+ else:
+ layout.prop(tex, "filter_eccentricity", text="Eccentricity")
+
+ layout.prop(tex, "filter_size")
+ layout.prop(tex, "filter_size_minimum")
+
class TEXTURE_PT_image_sampling(TextureTypePanel):
bl_label = "Image Sampling"
@@ -619,23 +643,14 @@ class TEXTURE_PT_image_sampling(TextureTypePanel):
row.active = tex.normal_map
row.prop(tex, "normal_space", text="")
- col.label(text="Filter:")
- col.prop(tex, "filter", text="")
- col.prop(tex, "filter_size")
- col.prop(tex, "filter_size_minimum")
col.prop(tex, "mipmap")
-
row = col.row()
row.active = tex.mipmap
row.prop(tex, "mipmap_gauss")
-
col.prop(tex, "interpolation")
- if tex.mipmap and tex.filter != 'DEFAULT':
- if tex.filter == 'FELINE':
- col.prop(tex, "filter_probes", text="Probes")
- else:
- col.prop(tex, "filter_eccentricity", text="Eccentricity")
+ texture_filter_common(tex, col)
+
class TEXTURE_PT_image_mapping(TextureTypePanel):
bl_label = "Image Mapping"
@@ -714,10 +729,51 @@ class TEXTURE_PT_envmap(TextureTypePanel):
def draw(self, context):
layout = self.layout
- # tex = context.texture
+ tex = context.texture
+ env = tex.environment_map
+
+ wide_ui = context.region.width > narrowui
+
+ row = layout.row()
+ row.prop(env, "source", expand=True)
+ row.menu("TEXTURE_MT_envmap_specials", icon='DOWNARROW_HLT', text="")
+
+ if env.source == 'IMAGE_FILE':
+ layout.template_ID(tex, "image", open="image.open")
+ layout.template_image(tex, "image", tex.image_user, compact=True)
+ else:
+ layout.prop(env, "mapping")
+ if env.mapping == 'PLANE':
+ layout.prop(env, "zoom")
+ layout.prop(env, "viewpoint_object")
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(env, "ignore_layers")
+ col.prop(env, "resolution")
+ col.prop(env, "depth")
+
+ if wide_ui:
+ col = split.column(align=True)
+
+ col.label(text="Clipping:")
+ col.prop(env, "clip_start", text="Start")
+ col.prop(env, "clip_end", text="End")
- layout.label(text="Nothing yet")
+class TEXTURE_PT_envmap_sampling(TextureTypePanel):
+ bl_label = "Environment Map Sampling"
+ bl_default_closed = True
+ tex_type = 'ENVIRONMENT_MAP'
+
+ def draw(self, context):
+ layout = self.layout
+
+ tex = context.texture
+
+ texture_filter_common(tex, layout)
+
class TEXTURE_PT_musgrave(TextureTypePanel):
bl_label = "Musgrave"
@@ -970,6 +1026,7 @@ class TEXTURE_PT_pointdensity_turbulence(TextureButtonsPanel):
classes = [
TEXTURE_MT_specials,
+ TEXTURE_MT_envmap_specials,
TEXTURE_PT_context_texture,
TEXTURE_PT_preview,
@@ -985,6 +1042,7 @@ classes = [
TEXTURE_PT_image_mapping,
TEXTURE_PT_plugin,
TEXTURE_PT_envmap,
+ TEXTURE_PT_envmap_sampling,
TEXTURE_PT_musgrave,
TEXTURE_PT_voronoi,
TEXTURE_PT_distortednoise,
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index 10fdbc7fa14..16cb8a8fb49 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -483,10 +483,10 @@ void default_tex(Tex *tex)
tex->vn_coltype = 0;
if (tex->env) {
- tex->env->stype=ENV_STATIC;
+ tex->env->stype=ENV_ANIM;
tex->env->clipsta=0.1;
tex->env->clipend=100;
- tex->env->cuberes=100;
+ tex->env->cuberes=600;
tex->env->depth=0;
}
@@ -1040,10 +1040,11 @@ EnvMap *BKE_add_envmap(void)
env= MEM_callocN(sizeof(EnvMap), "envmap");
env->type= ENV_CUBE;
- env->stype= ENV_STATIC;
+ env->stype= ENV_ANIM;
env->clipsta= 0.1;
env->clipend= 100.0;
- env->cuberes= 100;
+ env->cuberes= 600;
+ env->viewscale = 0.5;
return env;
}
diff --git a/source/blender/editors/render/render_intern.h b/source/blender/editors/render/render_intern.h
index cb1f143d826..ecb12f156ec 100644
--- a/source/blender/editors/render/render_intern.h
+++ b/source/blender/editors/render/render_intern.h
@@ -55,6 +55,9 @@ void SCENE_OT_render_layer_add(struct wmOperatorType *ot);
void SCENE_OT_render_layer_remove(struct wmOperatorType *ot);
void TEXTURE_OT_slot_move(struct wmOperatorType *ot);
+void TEXTURE_OT_envmap_save(struct wmOperatorType *ot);
+void TEXTURE_OT_envmap_clear(struct wmOperatorType *ot);
+void TEXTURE_OT_envmap_clear_all(struct wmOperatorType *ot);
/* render_internal.c */
void RENDER_OT_view_show(struct wmOperatorType *ot);
diff --git a/source/blender/editors/render/render_ops.c b/source/blender/editors/render/render_ops.c
index 9dc442665fb..e733ffbe5b6 100644
--- a/source/blender/editors/render/render_ops.c
+++ b/source/blender/editors/render/render_ops.c
@@ -67,6 +67,9 @@ void ED_operatortypes_render(void)
#endif
WM_operatortype_append(TEXTURE_OT_slot_move);
+ WM_operatortype_append(TEXTURE_OT_envmap_save);
+ WM_operatortype_append(TEXTURE_OT_envmap_clear);
+ WM_operatortype_append(TEXTURE_OT_envmap_clear_all);
/* render_internal.c */
WM_operatortype_append(RENDER_OT_view_show);
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index 7eeff31141b..254d842dbb7 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -37,21 +37,29 @@
#include "DNA_object_types.h"
#include "DNA_texture_types.h"
#include "DNA_scene_types.h"
+#include "DNA_space_types.h"
#include "DNA_world_types.h"
#include "BKE_context.h"
#include "BKE_depsgraph.h"
#include "BKE_font.h"
+#include "BKE_global.h"
#include "BKE_icons.h"
+#include "BKE_image.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_node.h"
+#include "BKE_report.h"
#include "BKE_scene.h"
#include "BKE_texture.h"
#include "BKE_utildefines.h"
#include "BKE_world.h"
+#include "IMB_imbuf.h"
+#include "IMB_imbuf_types.h"
+
+#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_editVert.h"
#include "BLI_listbase.h"
@@ -764,6 +772,196 @@ void TEXTURE_OT_slot_move(wmOperatorType *ot)
+/********************** environment map operators *********************/
+
+static int save_envmap(wmOperator *op, Scene *scene, EnvMap *env, char *str, int imtype)
+{
+ ImBuf *ibuf;
+ int dx;
+ int retval;
+
+ 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;
+
+ ibuf = IMB_allocImBuf(3*dx, 2*dx, 24, IB_rectfloat, 0);
+
+ if (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT)
+ ibuf->profile = IB_PROFILE_LINEAR_RGB;
+
+ 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);
+
+ if (BKE_write_ibuf(scene, 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;
+ }
+ IMB_freeImBuf(ibuf);
+ ibuf = NULL;
+
+ return retval;
+}
+
+static int envmap_save_exec(bContext *C, wmOperator *op)
+{
+ Tex *tex= CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data;
+ Scene *scene = CTX_data_scene(C);
+ //int imtype = RNA_enum_get(op->ptr, "file_type");
+ int imtype = scene->r.imtype;
+ char path[FILE_MAX];
+
+ RNA_string_get(op->ptr, "path", path);
+
+ if(scene->r.scemode & R_EXTENSION) {
+ BKE_add_image_extension(path, imtype);
+ }
+
+ WM_cursor_wait(1);
+
+ save_envmap(op, scene, tex->env, path, imtype);
+
+ WM_cursor_wait(0);
+
+ WM_event_add_notifier(C, NC_TEXTURE, tex);
+
+ return OPERATOR_FINISHED;
+}
+
+static int envmap_save_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+ //Scene *scene= CTX_data_scene(C);
+
+ if(!RNA_property_is_set(op->ptr, "relative_path"))
+ RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
+
+ if(RNA_property_is_set(op->ptr, "path"))
+ return envmap_save_exec(C, op);
+
+ //RNA_enum_set(op->ptr, "file_type", scene->r.imtype);
+
+ RNA_string_set(op->ptr, "path", G.sce);
+ WM_event_add_fileselect(C, op);
+
+ return OPERATOR_RUNNING_MODAL;
+}
+
+static int envmap_save_poll(bContext *C)
+{
+ Tex *tex= CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data;
+
+ if (!tex)
+ return 0;
+ if (!tex->env || !tex->env->ok)
+ return 0;
+ if (tex->env->type==ENV_PLANE)
+ return 0;
+ if (tex->env->cube[1]==NULL)
+ return 0;
+
+ return 1;
+}
+
+void TEXTURE_OT_envmap_save(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Save Environment Map";
+ ot->idname= "TEXTURE_OT_envmap_save";
+ ot->description="Save the current generated Environment map to an image file";
+
+ /* api callbacks */
+ ot->exec= envmap_save_exec;
+ ot->invoke= envmap_save_invoke;
+ ot->poll= envmap_save_poll;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+
+ /* 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);
+
+ RNA_def_boolean(ot->srna, "relative_path", 0, "Relative Path", "Save image with relative path to current .blend file");
+}
+
+static int envmap_clear_exec(bContext *C, wmOperator *op)
+{
+ Tex *tex= CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data;
+
+ BKE_free_envmapdata(tex->env);
+
+ WM_event_add_notifier(C, NC_TEXTURE|NA_EDITED, tex);
+
+ return OPERATOR_FINISHED;
+}
+
+static int envmap_clear_poll(bContext *C)
+{
+ Tex *tex= CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data;
+
+ if (!tex)
+ return 0;
+ if (!tex->env || !tex->env->ok)
+ return 0;
+ if (tex->env->cube[1]==NULL)
+ return 0;
+
+ return 1;
+}
+
+void TEXTURE_OT_envmap_clear(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Clear Environment Map";
+ ot->idname= "TEXTURE_OT_envmap_clear";
+ ot->description="Discard the environment map and free it from memory";
+
+ /* api callbacks */
+ ot->exec= envmap_clear_exec;
+ ot->poll= envmap_clear_poll;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
+static int envmap_clear_all_exec(bContext *C, wmOperator *op)
+{
+ Main *bmain = CTX_data_main(C);
+ Tex *tex;
+
+ for (tex=bmain->tex.first; tex; tex=tex->id.next)
+ BKE_free_envmapdata(tex->env);
+
+ WM_event_add_notifier(C, NC_TEXTURE|NA_EDITED, tex);
+
+ return OPERATOR_FINISHED;
+}
+
+void TEXTURE_OT_envmap_clear_all(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Clear All Environment Maps";
+ ot->idname= "TEXTURE_OT_envmap_clear_all";
+ ot->description="Discard all environment maps in the .blend file and free them from memory";
+
+ /* api callbacks */
+ ot->exec= envmap_clear_all_exec;
+ ot->poll= envmap_clear_poll;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
+/********************** material operators *********************/
+
/* material copy/paste */
static int copy_material_exec(bContext *C, wmOperator *op)
{
diff --git a/source/blender/editors/space_file/writeimage.c b/source/blender/editors/space_file/writeimage.c
index 2ffbd2da959..5045bfb21bf 100644
--- a/source/blender/editors/space_file/writeimage.c
+++ b/source/blender/editors/space_file/writeimage.c
@@ -61,32 +61,6 @@ static int saveover() {return 0;}
/* ------------------------------------------------------------------------- */
-
-void BIF_save_envmap(Scene *scene, EnvMap *env, char *str)
-{
- ImBuf *ibuf;
-/* extern rectcpy(); */
- int dx;
-
- /* all interactive stuff is handled in buttons.c */
- if(env->cube[0]==NULL) return;
-
- dx= env->cube[0]->x;
- ibuf= IMB_allocImBuf(3*dx, 2*dx, 24, IB_rect, 0);
-
- 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);
-
- BKE_write_ibuf(scene, ibuf, str, scene->r.imtype, scene->r.subimtype, scene->r.quality);
- IMB_freeImBuf(ibuf);
-}
-
-
-
/* callback for fileselect to save rendered image, renderresult was checked to exist */
static void save_rendered_image_cb_real(char *name, int confirm)
{
diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c
index 7d6547e1abb..01545735bb3 100644
--- a/source/blender/makesrna/intern/rna_texture.c
+++ b/source/blender/makesrna/intern/rna_texture.c
@@ -146,14 +146,20 @@ static void rna_Texture_type_set(PointerRNA *ptr, int value)
{
Tex *tex= (Tex*)ptr->data;
- if (value == TEX_VOXELDATA) {
- if (tex->vd == NULL) {
- tex->vd = BKE_add_voxeldata();
- }
- } else if (value == TEX_POINTDENSITY) {
- if (tex->pd == NULL) {
- tex->pd = BKE_add_pointdensity();
- }
+ switch(value) {
+
+ case TEX_VOXELDATA:
+ if (tex->vd == NULL)
+ tex->vd = BKE_add_voxeldata();
+ break;
+ case TEX_POINTDENSITY:
+ if (tex->pd == NULL)
+ tex->pd = BKE_add_pointdensity();
+ break;
+ case TEX_ENVMAP:
+ if (tex->env == NULL)
+ tex->env = BKE_add_envmap();
+ break;
}
tex->type = value;
@@ -661,9 +667,39 @@ static void rna_def_mtex(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
}
-static void rna_def_filter_size_common(StructRNA *srna)
+static void rna_def_filter_common(StructRNA *srna)
{
PropertyRNA *prop;
+
+ prop= RNA_def_property(srna, "mipmap", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_MIPMAP);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_ImageTexture_mipmap_set");
+ RNA_def_property_ui_text(prop, "MIP Map", "Uses auto-generated MIP maps for the image");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop= RNA_def_property(srna, "mipmap_gauss", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_GAUSS_MIP);
+ RNA_def_property_ui_text(prop, "MIP Map Gaussian filter", "Uses Gauss filter to sample down MIP maps");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop= RNA_def_property(srna, "filter", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "texfilter");
+ RNA_def_property_enum_items(prop, texture_filter_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_ImageTexture_filter_itemf");
+ RNA_def_property_ui_text(prop, "Filter", "Texture filter to use for sampling image");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop= RNA_def_property(srna, "filter_probes", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "afmax");
+ RNA_def_property_range(prop, 1, 256);
+ RNA_def_property_ui_text(prop, "Filter Probes", "Maximum number of samples. Higher gives less blur at distant/oblique angles, but is also slower");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop= RNA_def_property(srna, "filter_eccentricity", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "afmax");
+ RNA_def_property_range(prop, 1, 256);
+ RNA_def_property_ui_text(prop, "Filter Eccentricity", "Maximum eccentricity. Higher gives less blur at distant/oblique angles, but is also slower");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
prop= RNA_def_property(srna, "filter_size_minimum", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_FILTER_MIN);
@@ -678,36 +714,18 @@ static void rna_def_filter_size_common(StructRNA *srna)
RNA_def_property_update(prop, 0, "rna_Texture_update");
}
-static void rna_def_environment_map_common(StructRNA *srna)
+static void rna_def_environment_map(BlenderRNA *brna)
{
+ StructRNA *srna;
PropertyRNA *prop;
static EnumPropertyItem prop_source_items[] = {
{ENV_STATIC, "STATIC", 0, "Static", "Calculates environment map only once"},
{ENV_ANIM, "ANIMATED", 0, "Animated", "Calculates environment map at each rendering"},
- {ENV_LOAD, "LOADED", 0, "Loaded", "Loads saved environment map from disk"},
+ {ENV_LOAD, "IMAGE_FILE", 0, "Image File", "Loads a saved environment map image from disk"},
{0, NULL, 0, NULL, NULL}};
-
- prop= RNA_def_property(srna, "source", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "stype");
- RNA_def_property_enum_items(prop, prop_source_items);
- RNA_def_property_ui_text(prop, "Source", "");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- /* XXX: move this to specific types if needed */
- prop= RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "ima");
- RNA_def_property_struct_type(prop, "Image");
- RNA_def_property_ui_text(prop, "Image", "");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-}
-
-static void rna_def_environment_map(BlenderRNA *brna)
-{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static EnumPropertyItem prop_type_items[] = {
+
+ static EnumPropertyItem prop_mapping_items[] = {
{ENV_CUBE, "CUBE", 0, "Cube", "Use environment map with six cube sides"},
{ENV_PLANE, "PLANE", 0, "Plane", "Only one side is rendered, with Z axis pointing in direction of image"},
{0, NULL, 0, NULL, NULL}};
@@ -715,13 +733,23 @@ static void rna_def_environment_map(BlenderRNA *brna)
srna= RNA_def_struct(brna, "EnvironmentMap", NULL);
RNA_def_struct_sdna(srna, "EnvMap");
RNA_def_struct_ui_text(srna, "EnvironmentMap", "Environment map created by the renderer and cached for subsequent renders");
+
+ prop= RNA_def_property(srna, "source", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "stype");
+ RNA_def_property_enum_items(prop, prop_source_items);
+ RNA_def_property_ui_text(prop, "Source", "");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
- rna_def_environment_map_common(srna);
-
- prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ prop= RNA_def_property(srna, "viewpoint_object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "object");
+ RNA_def_property_ui_text(prop, "Viewpoint Object", "Object to use as the environment map's viewpoint location");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop= RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "type");
- RNA_def_property_enum_items(prop, prop_type_items);
- RNA_def_property_ui_text(prop, "Type", "");
+ RNA_def_property_enum_items(prop, prop_mapping_items);
+ RNA_def_property_ui_text(prop, "Mapping", "");
RNA_def_property_update(prop, 0, "rna_Texture_update");
prop= RNA_def_property(srna, "clip_start", PROP_FLOAT, PROP_NONE);
@@ -740,12 +768,16 @@ static void rna_def_environment_map(BlenderRNA *brna)
prop= RNA_def_property(srna, "zoom", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "viewscale");
- RNA_def_property_range(prop, 0.01, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.5, 5, 100, 2);
+ RNA_def_property_range(prop, 0.1, 5.0);
+ RNA_def_property_ui_range(prop, 0.5, 1.5, 1, 2);
RNA_def_property_ui_text(prop, "Zoom", "");
RNA_def_property_update(prop, 0, "rna_Texture_update");
- /* XXX: EnvMap.notlay */
+ prop= RNA_def_property(srna, "ignore_layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
+ RNA_def_property_boolean_sdna(prop, NULL, "notlay", 1);
+ RNA_def_property_array(prop, 20);
+ RNA_def_property_ui_text(prop, "Ignore Layers", "Hide objects on these layers when generating the Environment Map");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
prop= RNA_def_property(srna, "resolution", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "cuberes");
@@ -1116,17 +1148,6 @@ static void rna_def_texture_image(BlenderRNA *brna)
RNA_def_struct_ui_text(srna, "Image Texture", "");
RNA_def_struct_sdna(srna, "Tex");
- prop= RNA_def_property(srna, "mipmap", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_MIPMAP);
- RNA_def_property_boolean_funcs(prop, NULL, "rna_ImageTexture_mipmap_set");
- RNA_def_property_ui_text(prop, "MIP Map", "Uses auto-generated MIP maps for the image");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop= RNA_def_property(srna, "mipmap_gauss", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_GAUSS_MIP);
- RNA_def_property_ui_text(prop, "MIP Map Gaussian filter", "Uses Gauss filter to sample down MIP maps");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
prop= RNA_def_property(srna, "interpolation", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_INTERPOL);
RNA_def_property_ui_text(prop, "Interpolation", "Interpolates pixels using Area filter");
@@ -1153,7 +1174,7 @@ static void rna_def_texture_image(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Invert Alpha", "Inverts all the alpha values in the image");
RNA_def_property_update(prop, 0, "rna_Texture_update");
- rna_def_filter_size_common(srna);
+ rna_def_filter_common(srna);
prop= RNA_def_property(srna, "extension", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "extend");
@@ -1254,26 +1275,6 @@ static void rna_def_texture_image(BlenderRNA *brna)
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, 0, "rna_Texture_update");
- /* filtering */
- prop= RNA_def_property(srna, "filter", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "texfilter");
- RNA_def_property_enum_items(prop, texture_filter_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_ImageTexture_filter_itemf");
- RNA_def_property_ui_text(prop, "Filter", "Texture filter to use for sampling image");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop= RNA_def_property(srna, "filter_probes", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "afmax");
- RNA_def_property_range(prop, 1, 256);
- RNA_def_property_ui_text(prop, "Filter Probes", "Maximum number of samples. Higher gives less blur at distant/oblique angles, but is also slower");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop= RNA_def_property(srna, "filter_eccentricity", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "afmax");
- RNA_def_property_range(prop, 1, 256);
- RNA_def_property_ui_text(prop, "Filter Eccentricity", "Maximum eccentricity. Higher gives less blur at distant/oblique angles, but is also slower");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
/* Normal Map */
prop= RNA_def_property(srna, "normal_map", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_NORMALMAP);
@@ -1310,20 +1311,25 @@ static void rna_def_texture_environment_map(BlenderRNA *brna)
RNA_def_struct_ui_text(srna, "Environment Map", "Environment map texture");
RNA_def_struct_sdna(srna, "Tex");
- rna_def_environment_map_common(srna);
-
+ prop= RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "ima");
+ RNA_def_property_struct_type(prop, "Image");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Image", "Source image file to read the environment map from");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
prop= RNA_def_property(srna, "image_user", PROP_POINTER, 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, 0, "rna_Texture_update");
+ rna_def_filter_common(srna);
+
prop= RNA_def_property(srna, "environment_map", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "env");
RNA_def_property_struct_type(prop, "EnvironmentMap");
RNA_def_property_ui_text(prop, "Environment Map", "Gets the environment map associated with this texture");
RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- rna_def_filter_size_common(srna);
}
static void rna_def_texture_musgrave(BlenderRNA *brna)
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c b/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c
index 43a50235f9f..d2eb27d13c6 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c
@@ -54,7 +54,9 @@ static void node_composit_exec_output_file(void *data, bNode *node, bNodeStack *
ibuf->rect_float= cbuf->rect;
ibuf->dither= rd->dither_intensity;
- ibuf->profile = IB_PROFILE_LINEAR_RGB;
+
+ if (rd->color_mgt_flag & R_COLOR_MANAGEMENT)
+ ibuf->profile = IB_PROFILE_LINEAR_RGB;
if(in[1]->data) {
CompBuf *zbuf= in[1]->data;
diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c
index 5a69bcb45bd..c455a229d63 100644
--- a/source/blender/render/intern/source/envmap.c
+++ b/source/blender/render/intern/source/envmap.c
@@ -81,7 +81,7 @@ static void envmap_split_ima(EnvMap *env, ImBuf *ibuf)
}
else {
for(part=0; part<6; part++) {
- env->cube[part]= IMB_allocImBuf(dx, dx, 24, IB_rect, 0);
+ env->cube[part]= IMB_allocImBuf(dx, dx, 24, IB_rect|IB_rectfloat, 0);
}
IMB_rectcpy(env->cube[0], ibuf,
0, 0, 0, 0, dx, dx);
@@ -442,17 +442,18 @@ static void render_envmap(Render *re, EnvMap *env)
if(re->test_break(re->tbh)==0) {
RenderLayer *rl= envre->result->layers.first;
int y;
- char *alpha;
+ float *alpha;
- ibuf= IMB_allocImBuf(envre->rectx, envre->recty, 24, IB_rect, 0);
- ibuf->rect_float= rl->rectf;
- IMB_rect_from_float(ibuf);
- ibuf->rect_float= NULL;
+ ibuf= IMB_allocImBuf(envre->rectx, envre->recty, 24, IB_rect|IB_rectfloat, 0);
+ memcpy(ibuf->rect_float, rl->rectf, ibuf->channels * ibuf->x * ibuf->y * sizeof(float));
+
+ if (re->scene->r.color_mgt_flag & R_COLOR_MANAGEMENT)
+ ibuf->profile = IB_PROFILE_LINEAR_RGB;
/* envmap renders without alpha */
- alpha= ((char *)ibuf->rect)+3;
+ alpha= ((float *)ibuf->rect_float)+3;
for(y= ibuf->x*ibuf->y - 1; y>=0; y--, alpha+=4)
- *alpha= 255;
+ *alpha= 1.0;
env->cube[part]= ibuf;
}