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:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2014-07-18 16:40:11 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2014-08-12 05:10:31 +0400
commit1ddb8e238e1239998c810fca5733641005b0964f (patch)
tree7b9b583ad2c916ad036fd13feaff2b55bec82d92 /source/blender/freestyle/intern
parent7f3488f9925d974ac5e95385fccd61ede1531d1f (diff)
Freestyle: Keep a reference of the line style in Stroke rather than in StrokeRep.
Diffstat (limited to 'source/blender/freestyle/intern')
-rw-r--r--source/blender/freestyle/intern/blender_interface/BlenderStyleModule.h2
-rw-r--r--source/blender/freestyle/intern/stroke/Stroke.cpp7
-rw-r--r--source/blender/freestyle/intern/stroke/Stroke.h14
-rw-r--r--source/blender/freestyle/intern/stroke/StrokeLayer.cpp8
-rw-r--r--source/blender/freestyle/intern/stroke/StrokeLayer.h3
-rw-r--r--source/blender/freestyle/intern/stroke/StrokeRep.cpp2
-rw-r--r--source/blender/freestyle/intern/stroke/StrokeRep.h5
7 files changed, 21 insertions, 20 deletions
diff --git a/source/blender/freestyle/intern/blender_interface/BlenderStyleModule.h b/source/blender/freestyle/intern/blender_interface/BlenderStyleModule.h
index cff3593b761..ad656fdc3f7 100644
--- a/source/blender/freestyle/intern/blender_interface/BlenderStyleModule.h
+++ b/source/blender/freestyle/intern/blender_interface/BlenderStyleModule.h
@@ -57,7 +57,7 @@ public:
{
StrokeLayer *sl = StyleModule::execute();
- sl->SetLineStyle(_linestyle);
+ sl->setLineStyle(_linestyle);
return sl;
}
diff --git a/source/blender/freestyle/intern/stroke/Stroke.cpp b/source/blender/freestyle/intern/stroke/Stroke.cpp
index 158ceea93a3..c85295e72bf 100644
--- a/source/blender/freestyle/intern/stroke/Stroke.cpp
+++ b/source/blender/freestyle/intern/stroke/Stroke.cpp
@@ -774,13 +774,6 @@ void Stroke::ScaleThickness(float iFactor)
}
}
-void Stroke::SetLineStyle(struct FreestyleLineStyle *iLineStyle)
-{
- if (!_rep)
- _rep = new StrokeRep(this);
- _rep->setLineStyle(iLineStyle);
-}
-
void Stroke::Render(const StrokeRenderer *iRenderer)
{
if (!_rep)
diff --git a/source/blender/freestyle/intern/stroke/Stroke.h b/source/blender/freestyle/intern/stroke/Stroke.h
index e18e176baba..d68a5938e98 100644
--- a/source/blender/freestyle/intern/stroke/Stroke.h
+++ b/source/blender/freestyle/intern/stroke/Stroke.h
@@ -546,6 +546,7 @@ private:
bool _tips;
Vec2r _extremityOrientations[2]; // the orientations of the first and last extermity
StrokeRep *_rep;
+ FreestyleLineStyle *_lineStyle;
public:
/*! default constructor */
@@ -625,7 +626,6 @@ public:
/* Render method */
void ScaleThickness(float iFactor);
- void SetLineStyle(struct FreestyleLineStyle *iLineStyle);
void Render(const StrokeRenderer *iRenderer);
void RenderBasic(const StrokeRenderer *iRenderer);
@@ -645,6 +645,12 @@ public:
return _mediumType;
}
+ /*! Return the line style associated to this Stroke. */
+ inline FreestyleLineStyle *getLineStyle()
+ {
+ return _lineStyle;
+ }
+
/*! Returns the id of the texture used to simulate th marks system for this Stroke */
inline unsigned int getTextureId() {return _textureId;}
@@ -740,6 +746,12 @@ public:
/*! sets the 2D length of the Stroke. */
void setLength(float iLength);
+ /*! sets the line style of the Stroke. */
+ void setLineStyle(struct FreestyleLineStyle *iLineStyle)
+ {
+ _lineStyle = iLineStyle;
+ }
+
/*! sets the medium type that must be used for this Stroke. */
inline void setMediumType(MediumType iType)
{
diff --git a/source/blender/freestyle/intern/stroke/StrokeLayer.cpp b/source/blender/freestyle/intern/stroke/StrokeLayer.cpp
index 14251162168..ae8425625f2 100644
--- a/source/blender/freestyle/intern/stroke/StrokeLayer.cpp
+++ b/source/blender/freestyle/intern/stroke/StrokeLayer.cpp
@@ -36,17 +36,17 @@ StrokeLayer::~StrokeLayer()
clear();
}
-void StrokeLayer::ScaleThickness(float iFactor)
+void StrokeLayer::setLineStyle(struct FreestyleLineStyle *iLineStyle)
{
for (StrokeLayer::stroke_container::iterator s = _strokes.begin(), send = _strokes.end(); s != send; ++s) {
- (*s)->ScaleThickness(iFactor);
+ (*s)->setLineStyle(iLineStyle);
}
}
-void StrokeLayer::SetLineStyle(struct FreestyleLineStyle *iLineStyle)
+void StrokeLayer::ScaleThickness(float iFactor)
{
for (StrokeLayer::stroke_container::iterator s = _strokes.begin(), send = _strokes.end(); s != send; ++s) {
- (*s)->SetLineStyle(iLineStyle);
+ (*s)->ScaleThickness(iFactor);
}
}
diff --git a/source/blender/freestyle/intern/stroke/StrokeLayer.h b/source/blender/freestyle/intern/stroke/StrokeLayer.h
index 93eca3be8c7..31fe368d931 100644
--- a/source/blender/freestyle/intern/stroke/StrokeLayer.h
+++ b/source/blender/freestyle/intern/stroke/StrokeLayer.h
@@ -67,7 +67,6 @@ public:
/*! Render method */
void ScaleThickness(float iFactor);
- void SetLineStyle(struct FreestyleLineStyle *iLineStyle);
void Render(const StrokeRenderer *iRenderer);
void RenderBasic(const StrokeRenderer *iRenderer);
@@ -106,6 +105,8 @@ public:
_strokes.push_back(iStroke);
}
+ void setLineStyle(struct FreestyleLineStyle *iLineStyle);
+
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:StrokeLayer")
#endif
diff --git a/source/blender/freestyle/intern/stroke/StrokeRep.cpp b/source/blender/freestyle/intern/stroke/StrokeRep.cpp
index 25e242b9dbe..04087693e3b 100644
--- a/source/blender/freestyle/intern/stroke/StrokeRep.cpp
+++ b/source/blender/freestyle/intern/stroke/StrokeRep.cpp
@@ -725,7 +725,7 @@ StrokeRep::StrokeRep(Stroke *iStroke)
{
_stroke = iStroke;
_strokeType = iStroke->getMediumType();
- _lineStyle = NULL;
+ _lineStyle = iStroke->getLineStyle();
_textureId = iStroke->getTextureId();
_textureStep = iStroke->getTextureStep();
for (int a = 0; a < MAX_MTEX; a++) {
diff --git a/source/blender/freestyle/intern/stroke/StrokeRep.h b/source/blender/freestyle/intern/stroke/StrokeRep.h
index dad36cd01ed..cf07e7aa108 100644
--- a/source/blender/freestyle/intern/stroke/StrokeRep.h
+++ b/source/blender/freestyle/intern/stroke/StrokeRep.h
@@ -265,11 +265,6 @@ public:
_mtex[idx] = mtex_ptr;
}*/
- inline void setLineStyle(FreestyleLineStyle *iLineStyle)
- {
- _lineStyle = iLineStyle;
- }
-
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:StrokeRep")
#endif