Fix for Freestyle view map caching not properly updated upon changes of render resolu...
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>
Mon, 2 Feb 2015 00:17:16 +0000 (09:17 +0900)
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>
Mon, 2 Feb 2015 01:00:12 +0000 (10:00 +0900)
Problem reports independently by Light BWK and Folkert de Vries, thanks.

source/blender/freestyle/intern/application/Controller.cpp
source/blender/freestyle/intern/scene_graph/NodeSceneRenderLayer.h
source/blender/freestyle/intern/scene_graph/SceneHash.cpp

index 682183ef6ff99ae168b737fff165f47a879f91bc..8d9b1a4fb52b49b94d35499323d231b69f0e4012 100644 (file)
@@ -295,7 +295,7 @@ int Controller::LoadMesh(Render *re, SceneRenderLayer *srl)
                }
                cam->setProjectionMatrix(proj);
                _RootNode->AddChild(cam);
-               _RootNode->AddChild(new NodeSceneRenderLayer(*srl));
+               _RootNode->AddChild(new NodeSceneRenderLayer(*re->scene, *srl));
 
                sceneHashFunc.reset();
                //blenderScene->accept(sceneHashFunc);
index 2fc08bb1175121dab8fbf1498307c08f594376f5..4b079df5632fe016410c4a02abb695ac57f58ae3 100644 (file)
@@ -29,7 +29,7 @@
 #include "Node.h"
 
 extern "C" {
-#include "DNA_scene_types.h" /* for SceneRenderLayer */
+#include "DNA_scene_types.h" /* for Scene and SceneRenderLayer */
 }
 
 using namespace std;
@@ -39,14 +39,24 @@ namespace Freestyle {
 class NodeSceneRenderLayer : public Node
 {
 public:
-       inline NodeSceneRenderLayer(SceneRenderLayer& srl) : Node(), _SceneRenderLayer(srl) {}
+       inline NodeSceneRenderLayer(Scene& scene, SceneRenderLayer& srl) : Node(), _Scene(scene), _SceneRenderLayer(srl) {}
        virtual ~NodeSceneRenderLayer() {}
 
+       inline struct Scene& scene() const
+       {
+               return _Scene;
+       }
+
        inline struct SceneRenderLayer& sceneRenderLayer() const
        {
                return _SceneRenderLayer;
        }
 
+       inline void setSceneRenderLayer(Scene& scene)
+       {
+               _Scene = scene;
+       }
+
        inline void setSceneRenderLayer(SceneRenderLayer& srl)
        {
                _SceneRenderLayer = srl;
@@ -56,6 +66,8 @@ public:
        virtual void accept(SceneVisitor& v);
 
 protected:
+
+       Scene& _Scene;
        SceneRenderLayer& _SceneRenderLayer;
 };
 
index ee1d0c53b8750360924fa7020c203d0ceffcf64b..22538736fbf2d4fec5726efe5c0c0708701ef737 100644 (file)
@@ -35,13 +35,18 @@ string SceneHash::toString()
         return ss.str();
 }
 
-void SceneHash::visitNodeSceneRenderLayer(NodeSceneRenderLayer& srl)
+void SceneHash::visitNodeSceneRenderLayer(NodeSceneRenderLayer& node)
 {
-       struct FreestyleConfig *config = &srl.sceneRenderLayer().freestyleConfig;
-       adler32((unsigned char *)&config->flags, sizeof(int));
-       adler32((unsigned char *)&config->crease_angle, sizeof(float));
-       adler32((unsigned char *)&config->sphere_radius, sizeof(float));
-       adler32((unsigned char *)&config->dkr_epsilon, sizeof(float));
+       struct RenderData *r = &node.scene().r;
+       adler32((unsigned char *)&r->xsch, sizeof(r->xsch));  // resolution_x
+       adler32((unsigned char *)&r->ysch, sizeof(r->ysch));  // resolution_y
+       adler32((unsigned char *)&r->size, sizeof(r->size));  // resolution_percentage
+
+       struct FreestyleConfig *config = &node.sceneRenderLayer().freestyleConfig;
+       adler32((unsigned char *)&config->flags, sizeof(config->flags));
+       adler32((unsigned char *)&config->crease_angle, sizeof(config->crease_angle));
+       adler32((unsigned char *)&config->sphere_radius, sizeof(config->sphere_radius));
+       adler32((unsigned char *)&config->dkr_epsilon, sizeof(config->dkr_epsilon));
 }
 
 void SceneHash::visitNodeCamera(NodeCamera& cam)