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/scene_graph | |
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/scene_graph')
-rwxr-xr-x | source/blender/freestyle/intern/scene_graph/Rep.h | 6 |
1 files changed, 6 insertions, 0 deletions
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; }; |