1 // the general scene file loading handler
2 #include "OSGSceneFileHandler.h"
3 #include "OSGVerifyGraphOp.h"
5 #include "OSGModelRequest.h"
6 #include "OSGGraphOpSeq.h"
12 ModelRequest::ModelRequest(void) :
22 ModelRequest::~ModelRequest(void)
29 std::string
ModelRequest::getDescription(void)
31 return std::string("ModelRequest: ") + mFilename
;
34 void ModelRequest::execute(void)
36 std::cout
<< "ModelRequest: loading model: " << mFilename
<< std::endl
;
38 GraphOpSeqRefPtr pGraphOp
= NULL
;
40 if(szGraphOp
.compare("none") == 0)
44 else if(szGraphOp
.compare("default") == 0)
46 pGraphOp
= SceneFileHandler::the()->getDefaultGraphOp();
50 pGraphOp
= GraphOpSeq::create(szGraphOp
);
53 fprintf(stderr
, "Using graphop %p\n", static_cast<void *>(pGraphOp
.get()));
55 mModel
= SceneFileHandler::the()->read(mFilename
.c_str(),
58 if(bVerifyModel
== true)
60 std::cout
<< "verify model" << std::endl
;
62 VerifyGraphOpRefPtr vop
= VerifyGraphOp::create();
64 vop
->setRepair (true);
65 vop
->setVerbose(true);
67 vop
->traverse(mModel
.get());
72 pChangeList
->merge(*Thread::getCurrentChangeList());
77 void ModelRequest::sync(void)
79 if (mParent
!= NULL
&& mModel
!= NULL
)
81 std::cout
<< "ModelRequest: adding model to scene: "
85 mParent
->addChild(mModel
);
87 Thread::getCurrentChangeList()->merge(*pChangeList
);
93 void ModelRequest::setVerifyModel(bool bVal
)
98 void ModelRequest::setGraphOp(const std::string
&szVal
)