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:
-rw-r--r--source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp1
-rw-r--r--source/blender/freestyle/intern/python/BPy_SShape.cpp33
-rw-r--r--source/blender/freestyle/intern/python/BPy_ViewShape.cpp13
-rwxr-xr-xsource/blender/freestyle/intern/scene_graph/Rep.h6
-rwxr-xr-xsource/blender/freestyle/intern/view_map/Silhouette.h6
-rwxr-xr-xsource/blender/freestyle/intern/view_map/ViewMap.h2
-rwxr-xr-xsource/blender/freestyle/intern/view_map/ViewMapBuilder.cpp1
-rwxr-xr-xsource/blender/freestyle/intern/winged_edge/WEdge.cpp1
-rwxr-xr-xsource/blender/freestyle/intern/winged_edge/WEdge.h19
-rwxr-xr-xsource/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp1
10 files changed, 75 insertions, 8 deletions
diff --git a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
index ab7e58287cf..a4d10483238 100644
--- a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
+++ b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
@@ -411,6 +411,7 @@ void BlenderFileLoader::insertShapeNode(ObjectInstanceRen *obi, int id)
0);
// sets the id of the rep
rep->setId(Id(id, 0));
+ rep->setName(obi->ob->id.name+2);
const BBox<Vec3r> bbox = BBox<Vec3r>(Vec3r(ls.minBBox[0], ls.minBBox[1], ls.minBBox[2]),
Vec3r(ls.maxBBox[0], ls.maxBBox[1], ls.maxBBox[2]));
diff --git a/source/blender/freestyle/intern/python/BPy_SShape.cpp b/source/blender/freestyle/intern/python/BPy_SShape.cpp
index 512a19359a5..65951182f10 100644
--- a/source/blender/freestyle/intern/python/BPy_SShape.cpp
+++ b/source/blender/freestyle/intern/python/BPy_SShape.cpp
@@ -229,6 +229,37 @@ static PyObject * SShape_setId( BPy_SShape *self , PyObject *args) {
Py_RETURN_NONE;
}
+static char SShape_getName___doc__[] =
+".. method:: getName()\n"
+"\n"
+" Returns the name of the SShape.\n"
+"\n"
+" :return: The name string.\n"
+" :rtype: str\n";
+
+static PyObject * SShape_getName( BPy_SShape *self ) {
+ return PyUnicode_FromString( self->ss->getName().c_str() );
+}
+
+static char SShape_setName___doc__[] =
+".. method:: setName(name)\n"
+"\n"
+" Sets the name of the SShape.\n"
+"\n"
+" :arg name: A name string.\n"
+" :type name: str\n";
+
+static PyObject * SShape_setName( BPy_SShape *self , PyObject *args) {
+ char *s;
+
+ if(!( PyArg_ParseTuple(args, "s", &s) ))
+ return NULL;
+
+ self->ss->setName(s);
+
+ Py_RETURN_NONE;
+}
+
// const Material & material (unsigned i) const
// const vector< Material > & materials () const
// void SetMaterials (const vector< Material > &iMaterials)
@@ -244,6 +275,8 @@ static PyMethodDef BPy_SShape_methods[] = {
{"getEdgeList", ( PyCFunction ) SShape_getEdgeList, METH_NOARGS, SShape_getEdgeList___doc__},
{"getId", ( PyCFunction ) SShape_getId, METH_NOARGS, SShape_getId___doc__},
{"setId", ( PyCFunction ) SShape_setId, METH_VARARGS, SShape_setId___doc__},
+ {"getName", ( PyCFunction ) SShape_getName, METH_NOARGS, SShape_getName___doc__},
+ {"setName", ( PyCFunction ) SShape_setName, METH_VARARGS, SShape_setName___doc__},
{NULL, NULL, 0, NULL}
};
diff --git a/source/blender/freestyle/intern/python/BPy_ViewShape.cpp b/source/blender/freestyle/intern/python/BPy_ViewShape.cpp
index 8849b6b3776..eebfa88773c 100644
--- a/source/blender/freestyle/intern/python/BPy_ViewShape.cpp
+++ b/source/blender/freestyle/intern/python/BPy_ViewShape.cpp
@@ -153,6 +153,18 @@ static PyObject * ViewShape_getId( BPy_ViewShape *self ) {
return BPy_Id_from_Id( id );
}
+static char ViewShape_getName___doc__[] =
+".. method:: getName()\n"
+"\n"
+" Returns the name of the ViewShape.\n"
+"\n"
+" :return: The name string.\n"
+" :rtype: str\n";
+
+static PyObject * ViewShape_getName( BPy_ViewShape *self ) {
+ return PyUnicode_FromString( self->vs->getName().c_str() );
+}
+
static char ViewShape_setSShape___doc__[] =
".. method:: setSShape(iSShape)\n"
"\n"
@@ -282,6 +294,7 @@ static PyMethodDef BPy_ViewShape_methods[] = {
{"vertices", ( PyCFunction ) ViewShape_vertices, METH_NOARGS, ViewShape_vertices___doc__},
{"edges", ( PyCFunction ) ViewShape_edges, METH_NOARGS, ViewShape_edges___doc__},
{"getId", ( PyCFunction ) ViewShape_getId, METH_NOARGS, ViewShape_getId___doc__},
+ {"getName", ( PyCFunction ) ViewShape_getName, METH_NOARGS, ViewShape_getName___doc__},
{"setSShape", ( PyCFunction ) ViewShape_setSShape, METH_VARARGS, ViewShape_setSShape___doc__},
{"setVertices", ( PyCFunction ) ViewShape_setVertices, METH_VARARGS, ViewShape_setVertices___doc__},
{"setEdges", ( PyCFunction ) ViewShape_setEdges, METH_VARARGS, ViewShape_setEdges___doc__},
diff --git a/source/blender/freestyle/intern/scene_graph/Rep.h b/source/blender/freestyle/intern/scene_graph/Rep.h
index 6b213b01ba7..58be0374ae4 100755
--- a/source/blender/freestyle/intern/scene_graph/Rep.h
+++ b/source/blender/freestyle/intern/scene_graph/Rep.h
@@ -50,6 +50,7 @@ public:
: BaseObject()
{
_Id = iBrother._Id;
+ _Name = iBrother._Name;
if(0 == iBrother._FrsMaterial)
_FrsMaterial = 0;
else
@@ -60,11 +61,13 @@ public:
inline void swap(Rep& ioOther){
std::swap(_BBox,ioOther._BBox);
std::swap(_Id, ioOther._Id);
+ std::swap(_Name, ioOther._Name);
std::swap(_FrsMaterial,ioOther._FrsMaterial);
}
Rep& operator=(const Rep& iBrother){
if(&iBrother != this){
_Id = iBrother._Id;
+ _Name = iBrother._Name;
if(0 == iBrother._FrsMaterial)
_FrsMaterial = 0;
else{
@@ -108,11 +111,13 @@ public:
/*! Returns the rep bounding box */
virtual const BBox<Vec3r>& bbox() const {return _BBox;}
inline Id getId() const {return _Id;}
+ inline const string& getName() const {return _Name;}
inline const FrsMaterial * frs_material() const {return _FrsMaterial;}
/*! Sets the Rep bounding box */
virtual void setBBox(const BBox<Vec3r>& iBox) {_BBox = iBox;}
inline void setId(const Id& id) {_Id = id;}
+ inline void setName(const string& name) {_Name = name;}
inline void setFrsMaterial(const FrsMaterial& iMaterial)
{
_FrsMaterial = new FrsMaterial(iMaterial);
@@ -121,6 +126,7 @@ public:
private:
BBox<Vec3r> _BBox;
Id _Id;
+ string _Name;
FrsMaterial *_FrsMaterial;
};
diff --git a/source/blender/freestyle/intern/view_map/Silhouette.h b/source/blender/freestyle/intern/view_map/Silhouette.h
index fc0bff9cbff..86a4efcdc48 100755
--- a/source/blender/freestyle/intern/view_map/Silhouette.h
+++ b/source/blender/freestyle/intern/view_map/Silhouette.h
@@ -936,6 +936,7 @@ private:
vector<SVertex*> _verticesList; // list of all vertices
vector<FEdge*> _edgesList; // list of all edges
Id _Id;
+ string _Name;
BBox<Vec3r> _BBox;
vector<FrsMaterial> _FrsMaterials;
@@ -961,6 +962,7 @@ public:
{
userdata = 0;
_Id = iBrother._Id;
+ _Name = iBrother._Name;
_BBox = iBrother.bbox();
_FrsMaterials = iBrother._FrsMaterials;
@@ -1416,10 +1418,14 @@ public:
inline float importance() const {return _importance;}
/*! Returns the Id of the Shape. */
inline Id getId() const { return _Id; }
+ /*! Returns the name of the Shape. */
+ inline const string& getName() const { return _Name; }
/* Modififers */
/*! Sets the Id of the shape.*/
inline void setId(Id id) {_Id = id;}
+ /*! Sets the name of the shape.*/
+ inline void setName(const string& name) {_Name = name;}
/*! Sets the list of materials for the shape */
inline void setFrsMaterials(const vector<FrsMaterial>& iMaterials) {_FrsMaterials = iMaterials;}
inline void setViewShape(ViewShape *iShape) {_ViewShape = iShape;}
diff --git a/source/blender/freestyle/intern/view_map/ViewMap.h b/source/blender/freestyle/intern/view_map/ViewMap.h
index 5a9d8f3b57b..623348b61a7 100755
--- a/source/blender/freestyle/intern/view_map/ViewMap.h
+++ b/source/blender/freestyle/intern/view_map/ViewMap.h
@@ -1252,6 +1252,8 @@ public:
inline vector<ViewEdge*>& edges() {return _Edges;}
/*! Returns the ViewShape id. */
inline Id getId() const {return _SShape->getId();}
+ /*! Returns the ViewShape id. */
+ inline const string& getName() const {return _SShape->getName();}
/* modifiers */
/*! Sets the SShape on top of which the ViewShape is built. */
diff --git a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp
index 7e582e7f037..b010895a621 100755
--- a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp
+++ b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp
@@ -56,6 +56,7 @@ void ViewMapBuilder::computeInitialViewEdges(WingedEdge& we)
// create the embedding
psShape = new SShape;
psShape->setId((*it)->GetId());
+ psShape->setName((*it)->getName());
psShape->setFrsMaterials((*it)->frs_materials()); // FIXME
// create the view shape
diff --git a/source/blender/freestyle/intern/winged_edge/WEdge.cpp b/source/blender/freestyle/intern/winged_edge/WEdge.cpp
index 95be5f55794..1a3c9341374 100755
--- a/source/blender/freestyle/intern/winged_edge/WEdge.cpp
+++ b/source/blender/freestyle/intern/winged_edge/WEdge.cpp
@@ -475,6 +475,7 @@ WShape * WShape::duplicate()
WShape::WShape(WShape& iBrother)
{
_Id = iBrother.GetId();
+ _Name = iBrother._Name;
_FrsMaterials = iBrother._FrsMaterials;
_meanEdgeSize = iBrother._meanEdgeSize;
iBrother.bbox(_min, _max);
diff --git a/source/blender/freestyle/intern/winged_edge/WEdge.h b/source/blender/freestyle/intern/winged_edge/WEdge.h
index 9b05b4577a9..ebf26cd6d23 100755
--- a/source/blender/freestyle/intern/winged_edge/WEdge.h
+++ b/source/blender/freestyle/intern/winged_edge/WEdge.h
@@ -156,10 +156,10 @@ public:
increment();
return *this;
}
- virtual incoming_edge_iterator operator++(int) // opérateur correspondant à i++
- { // c.a.d qui renvoie la valeur *puis* incrémente.
- incoming_edge_iterator tmp = *this; // C'est pour cela qu'on stocke la valeur
- increment(); // dans un temporaire.
+ virtual incoming_edge_iterator operator++(int) // operator corresponding to i++
+ {
+ incoming_edge_iterator tmp = *this;
+ increment();
return tmp;
}
@@ -231,10 +231,10 @@ public:
increment();
return *this;
}
- virtual face_iterator operator++(int) // opérateur correspondant à i++
- { // c.a.d qui renvoie la valeur *puis* incrémente.
- face_iterator tmp = *this; // C'est pour cela qu'on stocke la valeur
- increment(); // dans un temporaire.
+ virtual face_iterator operator++(int) // operator corresponding to i++
+ {
+ face_iterator tmp = *this;
+ increment();
return tmp;
}
@@ -699,6 +699,7 @@ protected:
vector<WEdge*> _EdgeList;
vector<WFace*> _FaceList;
int _Id;
+ string _Name;
static unsigned _SceneCurrentId;
Vec3r _min;
Vec3r _max;
@@ -752,6 +753,7 @@ public:
inline const FrsMaterial& frs_material(unsigned i) const {return _FrsMaterials[i];}
inline const vector<FrsMaterial>& frs_materials() const {return _FrsMaterials;}
inline const real getMeanEdgeSize() const {return _meanEdgeSize;}
+ inline const string& getName() const {return _Name;}
/*! modifiers */
static inline void setCurrentId(const unsigned id) { _SceneCurrentId = id; }
inline void setEdgeList(const vector<WEdge*>& iEdgeList) {_EdgeList = iEdgeList;}
@@ -761,6 +763,7 @@ public:
inline void setBBox(const Vec3r& min, const Vec3r& max) {_min = min; _max=max;}
inline void setFrsMaterial(const FrsMaterial& frs_material, unsigned i) {_FrsMaterials[i]=frs_material;}
inline void setFrsMaterials(const vector<FrsMaterial>& iMaterials) {_FrsMaterials = iMaterials;}
+ inline void setName(const string& name) {_Name = name;}
/*! designed to build a specialized WFace
* for use in MakeFace
diff --git a/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp b/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp
index 9d22b4f8db5..80e06fc2b7b 100755
--- a/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp
+++ b/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp
@@ -26,6 +26,7 @@ void WXEdgeBuilder::visitIndexedFaceSet(IndexedFaceSet& ifs)
WXShape *shape = new WXShape;
buildWShape(*shape, ifs);
shape->setId(ifs.getId().getFirst());
+ shape->setName(ifs.getName());
//ifs.setId(shape->GetId());
}