diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-05-23 21:11:44 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-05-23 21:11:44 +0400 |
commit | 96e79172a010cba6bc826f570832ef4b355ea0cd (patch) | |
tree | 5e7bee49170faff126fa52d8fd389642876e4021 /source/blender/freestyle/intern/view_map | |
parent | 2212564f1804e3cc866003b226eac89575d53ade (diff) |
Made object names accessible from within style modules.
ViewShape objects in the view map, as well as SShape objects
that can be retrieved with ViewShape::sshape(), now have a
getName() method that returns the name of the object from
which each shape is created. For instance, visible feature
edges of specific mesh objects (e.g., Cube.001 and Cube.002)
can be selected using custom predicate ObjectNamesUP1D as
follows:
class ObjectNamesUP1D(UnaryPredicate1D):
def __init__(self, names):
UnaryPredicate1D.__init__(self)
self._names = names
def getName(self):
return "ObjectNamesUP1D"
def __call__(self, viewEdge):
return viewEdge.viewShape().getName() in self._names
upred = AndUP1D(QuantitativeInvisibilityUP1D(0),
ObjectNamesUP1D(["Cube.001", "Cube.002"]))
Operators.select(upred)
Diffstat (limited to 'source/blender/freestyle/intern/view_map')
-rwxr-xr-x | source/blender/freestyle/intern/view_map/Silhouette.h | 6 | ||||
-rwxr-xr-x | source/blender/freestyle/intern/view_map/ViewMap.h | 2 | ||||
-rwxr-xr-x | source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp | 1 |
3 files changed, 9 insertions, 0 deletions
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 |