Fix for view map cache not flushed by updates of edge detection options.

This fix should be considered for inclusion in the 2.73 release, since
it concerns a new feature of Freestyle introduced in 2.73.
This commit is contained in:
Tamito Kajiyama 2015-01-03 01:48:27 +09:00 committed by Sergey Sharybin
parent 5be01ff4b3
commit 91a975100c
7 changed files with 116 additions and 0 deletions

View File

@ -392,6 +392,8 @@ set(SRC
intern/scene_graph/NodeGroup.h
intern/scene_graph/NodeLight.cpp
intern/scene_graph/NodeLight.h
intern/scene_graph/NodeSceneRenderLayer.cpp
intern/scene_graph/NodeSceneRenderLayer.h
intern/scene_graph/NodeShape.cpp
intern/scene_graph/NodeShape.h
intern/scene_graph/NodeTransform.cpp

View File

@ -40,6 +40,7 @@ extern "C" {
#include "../scene_graph/NodeDrawingStyle.h"
#include "../scene_graph/NodeShape.h"
#include "../scene_graph/NodeTransform.h"
#include "../scene_graph/NodeSceneRenderLayer.h"
#include "../scene_graph/ScenePrettyPrinter.h"
#include "../scene_graph/VertexRep.h"
@ -294,6 +295,7 @@ int Controller::LoadMesh(Render *re, SceneRenderLayer *srl)
}
cam->setProjectionMatrix(proj);
_RootNode->AddChild(cam);
_RootNode->AddChild(new NodeSceneRenderLayer(*srl));
sceneHashFunc.reset();
//blenderScene->accept(sceneHashFunc);

View File

@ -0,0 +1,35 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/freestyle/intern/scene_graph/NodeSceneRenderLayer.cpp
* \ingroup freestyle
* \brief Class to represent a scene render layer in Blender.
*/
#include "NodeSceneRenderLayer.h"
namespace Freestyle {
void NodeSceneRenderLayer::accept(SceneVisitor& v)
{
v.visitNodeSceneRenderLayer(*this);
}
} /* namespace Freestyle */

View File

@ -0,0 +1,64 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef __FREESTYLE_NODE_SCENE_RENDER_LAYER_H__
#define __FREESTYLE_NODE_SCENE_RENDER_LAYER_H__
/** \file blender/freestyle/intern/scene_graph/NodeSceneRenderLayer.h
* \ingroup freestyle
* \brief Class to represent a scene render layer in Blender.
*/
#include "Node.h"
extern "C" {
#include "DNA_scene_types.h" /* for SceneRenderLayer */
}
using namespace std;
namespace Freestyle {
class NodeSceneRenderLayer : public Node
{
public:
inline NodeSceneRenderLayer(SceneRenderLayer& srl) : Node(), _SceneRenderLayer(srl) {}
virtual ~NodeSceneRenderLayer() {}
inline struct SceneRenderLayer& sceneRenderLayer() const
{
return _SceneRenderLayer;
}
inline void setSceneRenderLayer(SceneRenderLayer& srl)
{
_SceneRenderLayer = srl;
}
/*! Accept the corresponding visitor */
virtual void accept(SceneVisitor& v);
protected:
SceneRenderLayer& _SceneRenderLayer;
};
} /* namespace Freestyle */
#endif // __FREESTYLE_NODE_SCENE_RENDER_LAYER_H__

View File

@ -35,6 +35,15 @@ string SceneHash::toString()
return ss.str();
}
void SceneHash::visitNodeSceneRenderLayer(NodeSceneRenderLayer& srl)
{
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));
}
void SceneHash::visitNodeCamera(NodeCamera& cam)
{
double *proj = cam.projectionMatrix();

View File

@ -26,6 +26,7 @@
*/
#include "IndexedFaceSet.h"
#include "NodeSceneRenderLayer.h"
#include "NodeCamera.h"
#include "SceneVisitor.h"
@ -48,6 +49,7 @@ public:
virtual ~SceneHash() {}
VISIT_DECL(NodeCamera)
VISIT_DECL(NodeSceneRenderLayer)
VISIT_DECL(IndexedFaceSet)
string toString();

View File

@ -56,6 +56,7 @@ class NodeLight;
class NodeCamera;
class NodeDrawingStyle;
class NodeTransform;
class NodeSceneRenderLayer;
class Rep;
class LineRep;
@ -87,6 +88,7 @@ public:
VISIT_COMPLETE_DEF(NodeCamera)
VISIT_COMPLETE_DEF(NodeDrawingStyle)
VISIT_COMPLETE_DEF(NodeTransform)
VISIT_COMPLETE_DEF(NodeSceneRenderLayer)
VISIT_COMPLETE_DEF(Rep)
VISIT_COMPLETE_DEF(LineRep)