📄 property.cpp
字号:
}void Property::GenJointEntries(shared_ptr<Leaf> leaf, TEntryList& entries) const{ const Joint& joint = *shared_static_cast<Joint>(leaf); entries.push_back(Entry(wxT("FeedBackEnabled"),FormatBool(joint.FeedBackEnabled()))); for (int i=0;i<2;++i) { wxString strIdx = wxT("(") + FormatInt(i) + wxT(")"); const Joint::EBodyIndex idx = static_cast<Joint::EBodyIndex>(i); entries.push_back(Entry(wxT("GetFeedbackForce")+strIdx,FormatVector3(joint.GetFeedbackForce(idx)))); entries.push_back(Entry(wxT("GetFeedbackTorque")+strIdx,FormatVector3(joint.GetFeedbackTorque(idx)))); } for (int i=0;i<3;++i) { wxString strIdx = wxT("(") + FormatInt(i) + wxT(")"); const Joint::EAxisIndex idx = static_cast<Joint::EAxisIndex>(i); entries.push_back(Entry(wxT("GetBounce")+strIdx,FormatFloat(joint.GetBounce(idx)))); entries.push_back(Entry(wxT("GetLowStopDeg")+strIdx,FormatFloat(joint.GetLowStopDeg(idx)))); entries.push_back(Entry(wxT("GetHighStopDeg")+strIdx,FormatFloat(joint.GetHighStopDeg(idx)))); entries.push_back(Entry(wxT("GetLowStopPos")+strIdx,FormatFloat(joint.GetLowStopPos(idx)))); entries.push_back(Entry(wxT("GetHighStopPos")+strIdx,FormatFloat(joint.GetHighStopPos(idx)))); entries.push_back(Entry(wxT("GetCFM")+strIdx,FormatFloat(joint.GetCFM(idx)))); entries.push_back(Entry(wxT("GetStopCFM")+strIdx,FormatFloat(joint.GetStopCFM(idx)))); entries.push_back(Entry(wxT("GetSuspensionCFM")+strIdx,FormatFloat(joint.GetSuspensionCFM(idx)))); entries.push_back(Entry(wxT("GetStopERP")+strIdx,FormatFloat(joint.GetStopERP(idx)))); entries.push_back(Entry(wxT("GetSuspensionERP")+strIdx,FormatFloat(joint.GetSuspensionERP(idx)))); entries.push_back(Entry(wxT("GetLinearMotorVelocity")+strIdx,FormatFloat(joint.GetLinearMotorVelocity(idx)))); entries.push_back(Entry(wxT("GetAngularMotorVelocity")+strIdx,FormatFloat(joint.GetAngularMotorVelocity(idx)))); entries.push_back(Entry(wxT("GetMaxMotorForce")+strIdx,FormatFloat(joint.GetMaxMotorForce(idx)))); }}void Property::GenWorldEntries(shared_ptr<Leaf> leaf, TEntryList& entries) const{ const World& world = *shared_static_cast<World>(leaf); entries.push_back(Entry(wxT("GetGravity"),FormatVector3(world.GetGravity()))); entries.push_back(Entry(wxT("GetERP"),FormatFloat(world.GetERP()))); entries.push_back(Entry(wxT("GetCFM"),FormatFloat(world.GetCFM())));}void Property::GenCollisionHandlerEntries(shared_ptr<Leaf> leaf, TEntryList& entries) const{ shared_ptr<CollisionHandler> ch = shared_static_cast<CollisionHandler>(leaf); entries.push_back(Entry(wxT("IsSymmetricHandler"),FormatBool(ch->IsSymmetricHandler())));}void Property::GenContactJointEntries(shared_ptr<Leaf> leaf, TEntryList& entries) const{ const ContactJointHandler& cjh = *shared_static_cast<ContactJointHandler>(leaf); int mode = cjh.GetContactMode(); wxString strMode = FORMAT_FLAG(mode, dContactMu2) + FORMAT_FLAG(mode, dContactFDir1) + FORMAT_FLAG(mode, dContactBounce) + FORMAT_FLAG(mode, dContactSoftERP) + FORMAT_FLAG(mode, dContactSoftCFM) + FORMAT_FLAG(mode, dContactMotion1) + FORMAT_FLAG(mode, dContactMotion2) + FORMAT_FLAG(mode, dContactSlip1) + FORMAT_FLAG(mode, dContactSlip2) + FORMAT_FLAG(mode, dContactApprox0) + FORMAT_FLAG(mode, dContactApprox1_1) + FORMAT_FLAG(mode, dContactApprox1_2) + FORMAT_FLAG(mode, dContactApprox1); entries.push_back(Entry(wxT("GetContactMode"),strMode)); entries.push_back(Entry(wxT("GetBounceValue"),FormatFloat(cjh.GetBounceValue()))); entries.push_back(Entry(wxT("GetMinBounceVel"),FormatFloat(cjh.GetMinBounceVel()))); entries.push_back(Entry(wxT("GetContactSoftERP"),FormatFloat(cjh.GetContactSoftERP()))); entries.push_back(Entry(wxT("GetContactSoftCFM"),FormatFloat(cjh.GetContactSoftCFM()))); entries.push_back(Entry(wxT("GetContactSlip1"),FormatFloat(cjh.GetContactSlip1()))); entries.push_back(Entry(wxT("GetContactSlip2"),FormatFloat(cjh.GetContactSlip2()))); entries.push_back(Entry(wxT("GetContactMu"),FormatFloat(cjh.GetContactMu())));}void Property::GenDragControllerEntries(shared_ptr<Leaf> leaf, TEntryList& entries) const{ const DragController& dc = *shared_static_cast<DragController>(leaf); entries.push_back(Entry(wxT("GetLinearDrag"),FormatFloat(dc.GetLinearDrag()))); entries.push_back(Entry(wxT("GetAngularDrag"),FormatFloat(dc.GetAngularDrag())));}void Property::GetClassList(boost::shared_ptr<Class> cl, TClassList& clList) const{ if (cl.get() == 0) { return; } shared_ptr<SimSpark> spark = wxGetApp().GetSpark(); if (spark.get() == 0) { return; } TClassMap::const_iterator iter = mClassMap.find(wxString(cl->GetFullPath().c_str(), wxConvUTF8)); if (iter != mClassMap.end()) { clList.push_back((*iter).second); } const Class::TStringList& baseClasses = cl->GetBaseClasses(); for ( Class::TStringList::const_iterator iter = baseClasses.begin(); iter != baseClasses.end(); ++iter ) { string basePath = "/classes/"+(*iter); shared_ptr<Class> base = shared_dynamic_cast<Class> (spark->GetCore()->Get(basePath)); if (base.get() == 0) { cl->GetLog()->Error() << "(Property) invalid base class " << basePath << " defined for " << cl->GetFullPath() << std::endl; continue; } GetClassList(base, clList); }}void Property::GetClassList(boost::shared_ptr<Leaf> leaf, TClassList& clList) const{ clList.clear(); if (leaf.get() == 0) { return; } shared_ptr<Class> cl = leaf->GetClass(); GetClassList(cl, clList);}void Property::GenEntries(shared_ptr<zeitgeist::Leaf> leaf, const TClassList& clList, TEntryList& entries) const{ entries.clear(); if (leaf.get() == 0) { return; } for ( TClassList::const_reverse_iterator iter = clList.rbegin(); iter != clList.rend(); ++iter ) { switch (*iter) { default: break; case CL_LEAF: GenLeafEntries(leaf, entries); break; case CL_BASENODE: GenBaseNodeEntries(leaf, entries); break; case CL_CLASS: GenClassEntries(leaf, entries); break; case CL_TRANSFORM: GenTransformEntries(leaf, entries); break; case CL_BODY: GenBodyEntries(leaf, entries); break; case CL_HINGEJOINT: GenHingeEntries(leaf, entries); break; case CL_UNIVERSALJOINT: GenUniversalEntries(leaf, entries); break; case CL_JOINT: GenJointEntries(leaf, entries); break; case CL_WORLD: GenWorldEntries(leaf, entries); break; case CL_COLLISIONHANDLER: GenCollisionHandlerEntries(leaf, entries); break; case CL_CONTACTJOINTHANDLER: GenContactJointEntries(leaf, entries); break; case CL_DRAGCONTROLLER: GenDragControllerEntries(leaf, entries); break; case CL_MATERIALSOLID: GenSolidMaterialProperty(leaf, entries); break; } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -