本文整理汇总了C++中RendererPtr::getUID方法的典型用法代码示例。如果您正苦于以下问题:C++ RendererPtr::getUID方法的具体用法?C++ RendererPtr::getUID怎么用?C++ RendererPtr::getUID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RendererPtr
的用法示例。
在下文中一共展示了RendererPtr::getUID方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: destroyRenderer
bool Object::destroyRenderer(qlib::uid_t uid)
{
// get renderer ptr/check consistency
rendtab_t::iterator i = m_rendtab.find(uid);
if (i==m_rendtab.end())
return false;
RendererPtr pRend = i->second;
ScenePtr pScene = getScene();
if (pScene.isnull() || pRend.isnull()) {
LOG_DPRINTLN("Object::destroyRenderer> fatal error pScene or pRend is NULL!");
return false;
}
// detach renderer from the view-related resources (DL, VBO, etc)
pRend->unloading();
// Detach the parent scene from the renderer event source
pRend->removeListener(pScene.get());
// Fire the SCE_REND_REMOVING Event, before removing the renderer
{
MB_DPRINTLN("Object> Firing SCE_REND_REMOVING event...");
SceneEvent ev;
ev.setType(SceneEvent::SCE_REND_REMOVING);
ev.setSource(getSceneID());
ev.setTarget(pRend->getUID());
pScene->fireSceneEvent(ev);
}
// remove the rend from the scene's cache list
pScene->removeRendCache(pRend);
// 2012/9/30
// Detach the rend from obj HERE is very important!!
// (This call remove the rend from object's event listener list.
// Otherwise, deleted ptr will remain in the listener list, and thus cause crash!!)
qlib::uid_t objid = pRend->detachObj();
// MB_ASSERT(objid==this->m_uid);
// 2012/9/30
// Setting scene ID to null will cause removing pRend from the scene's listener list
// (Without this, deleted ptr will remain in scene's listener list, after clearing the UNDO data!!)
pRend->setSceneID(qlib::invalid_uid);
// Remove from the renderer table
m_rendtab.erase(i);
// Record undo/redo info
UndoManager *pUM = pScene->getUndoMgr();
if (pUM->isOK()) {
ObjLoadEditInfo *pPEI = MB_NEW ObjLoadEditInfo;
pPEI->setupRendDestroy(getUID(), pRend);
pUM->addEditInfo(pPEI);
}
return true;
}
示例2: registerRendererImpl
bool Object::registerRendererImpl(RendererPtr rrend)
{
bool res = m_rendtab.insert(rendtab_t::value_type(rrend->getUID(), rrend)).second;
if (!res)
return false;
rrend->setSceneID(getSceneID());
rrend->attachObj(this->m_uid);
ScenePtr pScene = getScene();
if (pScene.isnull())
return true;
// add the new rend to the scene's cache list
pScene->addRendCache(rrend);
// The scene observes events from the new renderer
//rrend->addPropListener(pScene.get());
rrend->addListener(pScene.get());
// Fire the SCE_REND_ADDED Event
{
MB_DPRINTLN("Object> Firing SCE_REND_ADDED event...");
SceneEvent ev;
ev.setType(SceneEvent::SCE_REND_ADDED);
ev.setSource(getSceneID());
ev.setTarget(rrend->getUID());
pScene->fireSceneEvent(ev);
}
// Record undo/redo info
UndoManager *pUM = pScene->getUndoMgr();
if (pUM->isOK()) {
ObjLoadEditInfo *pPEI = MB_NEW ObjLoadEditInfo;
pPEI->setupRendCreate(getUID(), rrend);
pUM->addEditInfo(pPEI);
}
return true;
}
示例3: dump
void Object::dump() const
{
ScenePtr rscn = getScene();
MB_DPRINT("Object: %s", toString().c_str());
MB_DPRINT(": {");
RendIter iter = beginRend();
for (; iter!=endRend(); ++iter) {
RendererPtr rrend = iter->second;
if (!rrend.isnull()) {
MB_DPRINT("rend %p/%d (nref=%d): ", rrend.get(), rrend->getUID(), rrend.use_count());
//rrend->dump();
}
else {
MB_DPRINTLN("(invalid rend %d)", iter->first);
}
}
MB_DPRINTLN("}");
}
示例4:
BOOST_FOREACH (const RendererPtr &i, tmpvec) {
uids.push_back(i->getUID());
++nret;
}
示例5: convToLWScene
void LWViewerManager::convToLWScene(qsys::ScenePtr pScene, qsys::ScenePtr pNewScene)
{
#ifndef QM_BUILD_LW
qsys::AutoStyleCtxt(pScene->getUID());
Scene::ObjIter iter = pScene->beginObj();
Scene::ObjIter eiter = pScene->endObj();
std::deque<ObjectPtr> newobjs;
LString objname, rendname;
for (; iter!=eiter; ++iter) {
ObjectPtr pObj = iter->second;
LWObjPtr pNewObj(new LWObject);
objname = pObj->getName();
pNewObj->setName(objname);
pNewObj->setDefaultPropFlag("name", false);
if (!pObj->isVisible()) {
pNewObj->setVisible(false);
pNewObj->setDefaultPropFlag("visible", false);
}
pNewObj->startBuild();
Object::RendIter riter = pObj->beginRend();
Object::RendIter reiter = pObj->endRend();
for (; riter!=reiter; ++riter) {
RendererPtr pRend = riter->second;
// ignore selection renderer
if (qlib::LChar::equals(pRend->getTypeName(), "*selection"))
continue;
LWRendPtr pNewRend = pNewObj->createRenderer("lwrend");
// set name
rendname = pRend->getName();
if (rendname.isEmpty())
rendname = LString("(") + pRend->getTypeName() + LString(")");
pNewRend->setName(rendname);
pNewRend->setDefaultPropFlag("name", false);
if (!pRend->isVisible()) {
pNewRend->setVisible(false);
pNewRend->setDefaultPropFlag("visible", false);
}
// Set Data ID of LWRend
pNewRend->setDataID(pNewRend->getUID());
pNewRend->setDefaultPropFlag("data_id", false);
LWRendDisplayContext *pdc = MB_NEW LWRendDisplayContext();
pdc->init(pNewRend.get(), pNewObj.get());
pdc->setAlpha(pRend->getDefaultAlpha());
pdc->startRender();
pdc->startSection(objname+":"+rendname);
pRend->display(pdc);
pRend->displayLabels(pdc);
pdc->endSection();
pdc->endRender();
// make hittest data
if (pRend->isHitTestSupported()) {
pdc->startHit(pRend->getUID());
pRend->displayHit(pdc);
pdc->endHit();
}
delete pdc;
}
pNewObj->endBuild();
newobjs.push_back(pNewObj);
}
BOOST_FOREACH (ObjectPtr pElem, newobjs) {
pNewScene->addObject(pElem);
}