diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-06-25 19:26:21 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-06-25 19:31:01 +0400 |
commit | b3f23dbcce2aa47cb9849aa3ef79c602754adbc0 (patch) | |
tree | 95eca2c92d9816f96b8228ccc4231b86409c97cf | |
parent | 5c2d7f76a60fba00ccbfad48c387261341e8049e (diff) |
Backport revisions for the release
da64e8ae0551b85760855b5b5bdfdb2673985223
88d8358f91e1306a67d59250162443194ee9edcf
-rw-r--r-- | intern/cycles/blender/blender_mesh.cpp | 18 | ||||
-rw-r--r-- | intern/cycles/render/image.cpp | 24 | ||||
-rw-r--r-- | intern/cycles/render/image.h | 4 | ||||
-rw-r--r-- | intern/cycles/render/nodes.cpp | 8 | ||||
-rw-r--r-- | source/blender/editors/render/render_preview.c | 9 |
5 files changed, 45 insertions, 18 deletions
diff --git a/intern/cycles/blender/blender_mesh.cpp b/intern/cycles/blender/blender_mesh.cpp index 27ea552c6a7..dc9f3c79fe3 100644 --- a/intern/cycles/blender/blender_mesh.cpp +++ b/intern/cycles/blender/blender_mesh.cpp @@ -208,7 +208,7 @@ static void mikk_compute_tangents(BL::Mesh b_mesh, BL::MeshTextureFaceLayer b_la /* Create Volume Attribute */ -static void create_mesh_volume_attribute(BL::Object b_ob, Mesh *mesh, ImageManager *image_manager, AttributeStandard std) +static void create_mesh_volume_attribute(BL::Object b_ob, Mesh *mesh, ImageManager *image_manager, AttributeStandard std, float frame) { BL::SmokeDomainSettings b_domain = object_smoke_domain_find(b_ob); @@ -222,22 +222,22 @@ static void create_mesh_volume_attribute(BL::Object b_ob, Mesh *mesh, ImageManag volume_data->manager = image_manager; volume_data->slot = image_manager->add_image(Attribute::standard_name(std), - b_ob.ptr.data, animated, is_float, is_linear, INTERPOLATION_LINEAR, true); + b_ob.ptr.data, animated, frame, is_float, is_linear, INTERPOLATION_LINEAR, true); } -static void create_mesh_volume_attributes(Scene *scene, BL::Object b_ob, Mesh *mesh) +static void create_mesh_volume_attributes(Scene *scene, BL::Object b_ob, Mesh *mesh, float frame) { /* for smoke volume rendering */ if(mesh->need_attribute(scene, ATTR_STD_VOLUME_DENSITY)) - create_mesh_volume_attribute(b_ob, mesh, scene->image_manager, ATTR_STD_VOLUME_DENSITY); + create_mesh_volume_attribute(b_ob, mesh, scene->image_manager, ATTR_STD_VOLUME_DENSITY, frame); if(mesh->need_attribute(scene, ATTR_STD_VOLUME_COLOR)) - create_mesh_volume_attribute(b_ob, mesh, scene->image_manager, ATTR_STD_VOLUME_COLOR); + create_mesh_volume_attribute(b_ob, mesh, scene->image_manager, ATTR_STD_VOLUME_COLOR, frame); if(mesh->need_attribute(scene, ATTR_STD_VOLUME_FLAME)) - create_mesh_volume_attribute(b_ob, mesh, scene->image_manager, ATTR_STD_VOLUME_FLAME); + create_mesh_volume_attribute(b_ob, mesh, scene->image_manager, ATTR_STD_VOLUME_FLAME, frame); if(mesh->need_attribute(scene, ATTR_STD_VOLUME_HEAT)) - create_mesh_volume_attribute(b_ob, mesh, scene->image_manager, ATTR_STD_VOLUME_HEAT); + create_mesh_volume_attribute(b_ob, mesh, scene->image_manager, ATTR_STD_VOLUME_HEAT, frame); if(mesh->need_attribute(scene, ATTR_STD_VOLUME_VELOCITY)) - create_mesh_volume_attribute(b_ob, mesh, scene->image_manager, ATTR_STD_VOLUME_VELOCITY); + create_mesh_volume_attribute(b_ob, mesh, scene->image_manager, ATTR_STD_VOLUME_VELOCITY, frame); } /* Create Mesh */ @@ -561,7 +561,7 @@ Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool object_updated, bool hide_tri else create_mesh(scene, mesh, b_mesh, used_shaders); - create_mesh_volume_attributes(scene, b_ob, mesh); + create_mesh_volume_attributes(scene, b_ob, mesh, b_scene.frame_current()); } if(render_layer.use_hair) diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp index f45131051da..532fc08c360 100644 --- a/intern/cycles/render/image.cpp +++ b/intern/cycles/render/image.cpp @@ -157,7 +157,8 @@ static bool image_equals(ImageManager::Image *image, const string& filename, voi image->interpolation == interpolation; } -int ImageManager::add_image(const string& filename, void *builtin_data, bool animated, bool& is_float, bool& is_linear, InterpolationType interpolation, bool use_alpha) +int ImageManager::add_image(const string& filename, void *builtin_data, bool animated, float frame, + bool& is_float, bool& is_linear, InterpolationType interpolation, bool use_alpha) { Image *img; size_t slot; @@ -168,8 +169,13 @@ int ImageManager::add_image(const string& filename, void *builtin_data, bool ani if(is_float) { /* find existing image */ for(slot = 0; slot < float_images.size(); slot++) { - if(float_images[slot] && image_equals(float_images[slot], filename, builtin_data, interpolation)) { - float_images[slot]->users++; + img = float_images[slot]; + if(img && image_equals(img, filename, builtin_data, interpolation)) { + if(img->frame != frame) { + img->frame = frame; + img->need_load = true; + } + img->users++; return slot; } } @@ -197,6 +203,7 @@ int ImageManager::add_image(const string& filename, void *builtin_data, bool ani img->builtin_data = builtin_data; img->need_load = true; img->animated = animated; + img->frame = frame; img->interpolation = interpolation; img->users = 1; img->use_alpha = use_alpha; @@ -205,8 +212,13 @@ int ImageManager::add_image(const string& filename, void *builtin_data, bool ani } else { for(slot = 0; slot < images.size(); slot++) { - if(images[slot] && image_equals(images[slot], filename, builtin_data, interpolation)) { - images[slot]->users++; + img = images[slot]; + if(img && image_equals(img, filename, builtin_data, interpolation)) { + if(img->frame != frame) { + img->frame = frame; + img->need_load = true; + } + img->users++; return slot+tex_image_byte_start; } } @@ -234,6 +246,7 @@ int ImageManager::add_image(const string& filename, void *builtin_data, bool ani img->builtin_data = builtin_data; img->need_load = true; img->animated = animated; + img->frame = frame; img->interpolation = interpolation; img->users = 1; img->use_alpha = use_alpha; @@ -242,6 +255,7 @@ int ImageManager::add_image(const string& filename, void *builtin_data, bool ani slot += tex_image_byte_start; } + need_update = true; return slot; diff --git a/intern/cycles/render/image.h b/intern/cycles/render/image.h index 8abf2a33d74..9593737b0d3 100644 --- a/intern/cycles/render/image.h +++ b/intern/cycles/render/image.h @@ -55,7 +55,8 @@ public: ImageManager(); ~ImageManager(); - int add_image(const string& filename, void *builtin_data, bool animated, bool& is_float, bool& is_linear, InterpolationType interpolation, bool use_alpha); + int add_image(const string& filename, void *builtin_data, bool animated, float frame, + bool& is_float, bool& is_linear, InterpolationType interpolation, bool use_alpha); void remove_image(int slot); void remove_image(const string& filename, void *builtin_data, InterpolationType interpolation); bool is_float_image(const string& filename, void *builtin_data, bool& is_linear); @@ -82,6 +83,7 @@ public: bool use_alpha; bool need_load; bool animated; + float frame; InterpolationType interpolation; int users; diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp index 1a1667ff1b3..06d06c867d8 100644 --- a/intern/cycles/render/nodes.cpp +++ b/intern/cycles/render/nodes.cpp @@ -243,7 +243,9 @@ void ImageTextureNode::compile(SVMCompiler& compiler) image_manager = compiler.image_manager; if(is_float == -1) { bool is_float_bool; - slot = image_manager->add_image(filename, builtin_data, animated, is_float_bool, is_linear, interpolation, use_alpha); + slot = image_manager->add_image(filename, builtin_data, + animated, 0, is_float_bool, is_linear, + interpolation, use_alpha); is_float = (int)is_float_bool; } @@ -408,7 +410,9 @@ void EnvironmentTextureNode::compile(SVMCompiler& compiler) image_manager = compiler.image_manager; if(slot == -1) { bool is_float_bool; - slot = image_manager->add_image(filename, builtin_data, animated, is_float_bool, is_linear, INTERPOLATION_LINEAR, use_alpha); + slot = image_manager->add_image(filename, builtin_data, + animated, 0, is_float_bool, is_linear, + INTERPOLATION_LINEAR, use_alpha); is_float = (int)is_float_bool; } diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index 46777685442..fa9067c6041 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -1137,6 +1137,13 @@ void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, M wmJob *wm_job; ShaderPreview *sp; Scene *scene = CTX_data_scene(C); + short id_type = GS(id->name); + bool use_new_shading = BKE_scene_use_new_shading_nodes(scene); + + /* Only texture node preview is supported with Cycles. */ + if (use_new_shading && method == PR_NODE_RENDER && id_type != ID_TE) { + return; + } wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), owner, "Shader Preview", WM_JOB_EXCL_RENDER, WM_JOB_TYPE_RENDER_PREVIEW); @@ -1154,7 +1161,7 @@ void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, M /* hardcoded preview .blend for cycles/internal, this should be solved * once with custom preview .blend path for external engines */ - if (BKE_scene_use_new_shading_nodes(scene) && method != PR_NODE_RENDER) + if ((method != PR_NODE_RENDER) && id_type != ID_TE && use_new_shading) sp->pr_main = G_pr_main_cycles; else sp->pr_main = G_pr_main; |