[Bf-blender-cvs] [852969826ff] temp-udim-images: Merge branch 'blender2.8' into udim
Lukas Stockner
noreply at git.blender.org
Fri Jun 15 14:09:20 CEST 2018
Commit: 852969826ffdaf840a38a8ec8619a462fbaac92d
Author: Lukas Stockner
Date: Fri Jun 15 14:09:03 2018 +0200
Branches: temp-udim-images
https://developer.blender.org/rB852969826ffdaf840a38a8ec8619a462fbaac92d
Merge branch 'blender2.8' into udim
===================================================================
===================================================================
diff --cc intern/cycles/blender/blender_session.cpp
index e5362568fc4,8e76a4c0061..af0e4814d23
--- a/intern/cycles/blender/blender_session.cpp
+++ b/intern/cycles/blender/blender_session.cpp
@@@ -138,9 -138,13 +138,13 @@@ void BlenderSession::create_session(
/* setup callbacks for builtin image support */
scene->image_manager->builtin_image_info_cb = function_bind(&BlenderSession::builtin_image_info, this, _1, _2, _3);
- scene->image_manager->builtin_image_pixels_cb = function_bind(&BlenderSession::builtin_image_pixels, this, _1, _2, _3, _4, _5);
- scene->image_manager->builtin_image_float_pixels_cb = function_bind(&BlenderSession::builtin_image_float_pixels, this, _1, _2, _3, _4, _5);
+ scene->image_manager->builtin_image_pixels_cb = function_bind(&BlenderSession::builtin_image_pixels, this, _1, _2, _3, _4, _5, _6);
+ scene->image_manager->builtin_image_float_pixels_cb = function_bind(&BlenderSession::builtin_image_float_pixels, this, _1, _2, _3, _4, _5, _6);
+ #ifdef WITH_OCIO
+ scene->film->set_color_config(OCIO_getCurrentConfig());
+ #endif
+
session->scene = scene;
/* There is no single depsgraph to use for the entire render.
diff --cc intern/cycles/render/image.cpp
index 3297c749fe4,023ca4b47c2..eefca4a8eb7
--- a/intern/cycles/render/image.cpp
+++ b/intern/cycles/render/image.cpp
@@@ -333,10 -348,9 +352,10 @@@ int ImageManager::add_image(const strin
img = new Image();
img->filename = filename;
img->builtin_data = builtin_data;
- img->builtin_free_cache = metadata.builtin_free_cache;
+ img->metadata = metadata;
img->need_load = true;
img->animated = animated;
+ img->tile = tile;
img->frame = frame;
img->interpolation = interpolation;
img->extension = extension;
@@@ -564,18 -563,16 +572,18 @@@ bool ImageManager::file_load_image(Imag
if(FileFormat == TypeDesc::FLOAT) {
builtin_image_float_pixels_cb(img->filename,
img->builtin_data,
+ img->tile,
(float*)&pixels[0],
num_pixels * components,
- img->builtin_free_cache);
+ img->metadata.builtin_free_cache);
}
else if(FileFormat == TypeDesc::UINT8) {
builtin_image_pixels_cb(img->filename,
img->builtin_data,
+ img->tile,
(uchar*)&pixels[0],
num_pixels * components,
- img->builtin_free_cache);
+ img->metadata.builtin_free_cache);
}
else {
/* TODO(dingto): Support half for ImBuf. */
diff --cc intern/cycles/render/light.cpp
index d45d4543e16,5a58ef1aa8e..0947d0547c1
--- a/intern/cycles/render/light.cpp
+++ b/intern/cycles/render/light.cpp
@@@ -546,13 -547,34 +547,38 @@@ void LightManager::device_update_backgr
assert(kintegrator->use_direct_light);
/* get the resolution from the light's size (we stuff it in there) */
- int res = background_light->map_resolution;
- kintegrator->pdf_background_res = res;
-
- assert(res > 0);
+ int2 res = make_int2(background_light->map_resolution, background_light->map_resolution/2);
+ /* If the resolution isn't set manually, try to find an environment texture. */
+ if (res.x == 0) {
+ Shader *shader = (scene->background->shader) ? scene->background->shader : scene->default_background;
+ foreach(ShaderNode *node, shader->graph->nodes) {
+ if(node->type == EnvironmentTextureNode::node_type) {
+ EnvironmentTextureNode *env = (EnvironmentTextureNode*) node;
+ ImageMetaData metadata;
- if(env->image_manager && env->image_manager->get_image_metadata(env->slot, metadata)) {
- res.x = max(res.x, metadata.width);
- res.y = max(res.y, metadata.height);
++ if(env->image_manager) {
++ foreach(int slot, env->slots) {
++ if(env->image_manager->get_image_metadata(slot, metadata)) {
++ res.x = max(res.x, metadata.width);
++ res.y = max(res.y, metadata.height);
++ }
++ }
+ }
+ }
+ }
+ if (res.x > 0 && res.y > 0) {
+ VLOG(2) << "Automatically set World MIS resolution to " << res.x << " by " << res.y << "\n";
+ }
+ }
+ /* If it's still unknown, just use the default. */
+ if (res.x == 0 || res.y == 0) {
+ res = make_int2(1024, 512);
+ VLOG(2) << "Setting World MIS resolution to default\n";
+ }
+ kintegrator->pdf_background_res_x = res.x;
+ kintegrator->pdf_background_res_y = res.y;
vector<float3> pixels;
- shade_background_pixels(device, dscene, res, pixels, progress);
+ shade_background_pixels(device, dscene, res.x, res.y, pixels, progress);
if(progress.get_cancel())
return;
diff --cc release/scripts/startup/bl_ui/space_image.py
index 72e07086bb0,1acc8cf601d..b13debde1cc
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@@ -724,38 -724,43 +724,69 @@@ class IMAGE_PT_view_properties(Panel)
row.active = uvedit.show_other_objects
row.prop(uvedit, "other_uv_filter", text="Filter")
- if show_render and ima:
- layout.separator()
- render_slot = ima.render_slots.active
- layout.prop(render_slot, "name", text="Slot Name")
+
+ class IMAGE_UL_render_slots(UIList):
+ def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
+ slot = item
+ layout.prop(slot, "name", text="", emboss=False)
+
+
+ class IMAGE_PT_render_slots(Panel):
+ bl_space_type = 'IMAGE_EDITOR'
+ bl_region_type = 'UI'
+ bl_label = "Render Slots"
+
+ @classmethod
+ def poll(cls, context):
+ sima = context.space_data
+ return (sima and sima.image and sima.show_render)
+
+ def draw(self, context):
+ layout = self.layout
+
+ sima = context.space_data
+ ima = sima.image
+
+ row = layout.row()
+
+ col = row.column()
+ col.template_list("IMAGE_UL_render_slots", "render_slots", ima, "render_slots", ima.render_slots, "active_index", rows=3)
+
+ col = row.column(align=True)
+ col.operator("image.add_render_slot", icon='ZOOMIN', text="")
+ col.operator("image.remove_render_slot", icon='ZOOMOUT', text="")
+
+ col.separator()
+
+ col.operator("image.clear_render_slot", icon='X', text="")
+class IMAGE_PT_tile_properties(Panel):
+ bl_space_type = 'IMAGE_EDITOR'
+ bl_region_type = 'UI'
+ bl_label = "Tiles"
+
+ @classmethod
+ def poll(cls, context):
+ sima = context.space_data
+ return (sima and sima.image and sima.image.source == 'TILED')
+
+ def draw(self, context):
+ layout = self.layout
+
+ sima = context.space_data
+ ima = sima.image
+
+ row = layout.row(align=True)
+ row.operator("image.add_tile")
+ row.operator("image.remove_tile")
+
+ layout.prop(sima, "current_tile")
+ tile = ima.tiles[sima.current_tile]
+ layout.prop(tile, "label")
+ layout.operator("image.generate_tile")
+
+
class IMAGE_PT_tools_transform_uvs(Panel, UVToolsPanel):
bl_label = "Transform"
@@@ -1387,8 -1392,9 +1418,10 @@@ classes =
IMAGE_PT_active_mask_spline,
IMAGE_PT_active_mask_point,
IMAGE_PT_image_properties,
+ IMAGE_UL_render_slots,
+ IMAGE_PT_render_slots,
IMAGE_PT_view_properties,
+ IMAGE_PT_tile_properties,
IMAGE_PT_tools_transform_uvs,
IMAGE_PT_tools_align_uvs,
IMAGE_PT_tools_uvs,
diff --cc source/blender/blenkernel/intern/image.c
index dfa1e0d14ba,3e7a9de6968..f2cff2d1dfb
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@@ -393,10 -379,12 +392,16 @@@ static void image_init(Image *ima, shor
if (source == IMA_SRC_VIEWER)
ima->flag |= IMA_VIEW_AS_RENDER;
+ ima->num_tiles = 1;
+ ima->tiles = MEM_callocN(sizeof(ImageTile), "Image Tiles");
+ ima->tiles[0].ok = IMA_OK;
+
+ if (type == IMA_TYPE_R_RESULT) {
+ for (int i = 0; i < 8; i++) {
+ BKE_image_add_renderslot(ima, NULL);
+ }
+ }
+
BKE_color_managed_colorspace_settings_init(&ima->colorspace_settings);
ima->stereo3d_format = MEM_callocN(sizeof(Stereo3dFormat), "Image Stereo Format");
}
diff --cc source/blender/blenloader/intern/readfile.c
index 5603f54e3d0,9267e956642..15eb65a39fe
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@@ -1640,18 -1641,14 +1640,18 @@@ void blo_make_image_pointer_map(FileDat
for (; ima; ima = ima->id.next) {
if (ima->cache)
oldnewmap_insert(fd->imamap, ima->cache, ima->cache, 0);
- for (a = 0; a < TEXTARGET_COUNT; a++)
- if (ima->gputexture[a])
- oldnewmap_insert(fd->imamap, ima->gputexture[a], ima->gputexture[a], 0);
if (ima->rr)
oldnewmap_insert(fd->imamap, ima->rr, ima->rr, 0);
- for (int a = 0; a < IMA_MAX_RENDER_SLOT; a++)
- if (ima->renders[a])
- oldnewmap_insert(fd->imamap, ima->renders[a], ima->renders[a], 0);
- LISTBASE_FOREACH(RenderSlot *, slot, &ima->renderslots)
- if (slot->render)
- oldnewmap_insert(fd->imamap, slot->render, slot->render, 0);
+ for (int a = 0; a < ima->num_tiles; a++) {
+ for (int b = 0; b < TEXTARGET_COUNT; b++) {
+ if (ima->tiles[a].gputexture[b]) {
+ oldnewmap_insert(fd->imamap, ima->tiles[a].gputexture[b], ima->tiles[a].gputexture[b], 0);
+ }
+ }
+ }
++ LISTBASE_FOREACH(RenderSlot *, slot, &ima->renderslots)
++ if (slot->render)
++ oldnewmap_insert(fd->imamap, slot->render, slot->render, 0);
}
for (; sce; sce = sce->id.next) {
if (sce->nodetree && sce->nodetree->previews) {
@@@ -1682,23 -1680,16 +1682,23 @@@ void blo_end_image_pointer_map(FileDat
ima->cache = newimaadr(fd, ima->cache);
if (ima->cache == NULL) {
ima->tpageflag &= ~IMA_GLBIND_IS_DATA;
- for (i = 0; i < TEXTARGET_COUNT; i++) {
- ima->gputexture[i] = NULL;
- }
ima->rr = NULL;
+ for (int i = 0; i < ima->num_tiles; i++) {
+ for (int j = 0; j < TEXTARGET_COUNT; j++)
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list