TracNav menu
-
Home
- About
-
Features
- Performance
- Multi-Threading
- Clustering
- Extensibility
- Comparison
-
Getting Started
-
Download
- Releases
- Dependencies
- Daily Builds
- Source
- API Documentation
- Building
- Demos
-
Help
- Tutorial
- FAQ
- How to?
- Reference
-
Community
- Application Gallery
- Mailing lists
-
External Support
- OpenSG Forum
- OpenSG Plus
- Users
-
Development
- Developers
-
Contributing
- CodeBazaar
- ProjectIdeas
-
Future
- Documentation
- Marketing
- Building
- File IO
- CodingStandard
beginEditCP() and endEditCP() are going away in 2.0 but you want to develop in 1.x now and migrate to 2.0 once it is stable. In this case you might consider the following:
using namespace OSG; class FCEditGuard { public: #if OSG_MAJOR_VERSION < 2 FCEditGuard(const FieldContainerPtr &a, BitVector b = FieldBits::AllFields, UInt32 c = ChangedOrigin::External) : obj(a), mask(b), origin(c) { beginEditCP(obj, mask, origin); } #else FCEditGuard(const FieldContainerPtr &, BitVector = FieldBits::AllFields, UInt32 = ChangedOrigin::External) {} #endif ~FCEditGuard() { #if OSG_MAJOR_VERSION < 2 endEditCP(obj, mask, origin); #endif } private: #if OSG_MAJOR_VERSION < 2 const FieldContainerPtr &obj; BitVector mask; UInt32 origin; #endif };
Usage:
using namespace OSG;
:
NodePtr scene_root = Node::create();
{
FCEditGuard f(scene_root);
scene_root->setCore(Group::create());
} // f.~FCEditGuard() called here
:
For those worried about space, for OSG_MAJOR_VERSION ≥ 2 any decent compiler should be able to remove the then empty instances of type FCEditGuard from the translation unit.
Submitted by Jan Springer, 2006/11/02.
