fixed bind/newparam problem in collada writer

This commit is contained in:
rdiankov 2010-12-17 03:02:51 +00:00
parent 2a6e9665bb
commit 37e10c333c
1 changed files with 16 additions and 16 deletions

View File

@ -472,9 +472,9 @@ protected:
string asmsym = str(boost::format("%s.%s")%asmid%_ikmout->ikm->getSid());
string assym = str(boost::format("%s.%s")%_scene.kscene->getID()%_ikmout->ikm->getSid());
FOREACH(it, _ikmout->vkinematicsbindings) {
domKinematics_bindRef abm = daeSafeCast<domKinematics_bind>(ias_motion->add(COLLADA_ELEMENT_BIND));
abm->setSymbol(asmsym.c_str());
daeSafeCast<domKinematics_param>(abm->add(COLLADA_ELEMENT_PARAM))->setRef(it->first.c_str());
domKinematics_newparamRef abm = daeSafeCast<domKinematics_newparam>(ias_motion->add(COLLADA_ELEMENT_NEWPARAM));
abm->setSid(asmsym.c_str());
daeSafeCast<domKinematics_newparam::domSIDREF>(abm->add(COLLADA_ELEMENT_SIDREF))->setValue(it->first.c_str());
domKinematics_bindRef ab = daeSafeCast<domKinematics_bind>(ias->add(COLLADA_ELEMENT_BIND));
ab->setSymbol(assym.c_str());
daeSafeCast<domKinematics_param>(ab->add(COLLADA_ELEMENT_PARAM))->setRef(asmsym.c_str());
@ -482,17 +482,17 @@ protected:
}
for(size_t idof = 0; idof < _ikmout->vaxissids.size(); ++idof) {
const axis_sids& kas = _ikmout->vaxissids.at(idof);
domKinematics_bindRef abm = daeSafeCast<domKinematics_bind>(ias_motion->add(COLLADA_ELEMENT_BIND));
abm->setSymbol(str(boost::format("%s.%s")%asmid%kas.axissid).c_str());
daeSafeCast<domKinematics_param>(abm->add(COLLADA_ELEMENT_PARAM))->setRef(kas.axissid.c_str());
domKinematics_newparamRef abm = daeSafeCast<domKinematics_newparam>(ias_motion->add(COLLADA_ELEMENT_NEWPARAM));
abm->setSid(str(boost::format("%s.%s")%asmid%kas.axissid).c_str());
daeSafeCast<domKinematics_newparam::domSIDREF>(abm->add(COLLADA_ELEMENT_SIDREF))->setValue(kas.axissid.c_str());
domKinematics_bindRef ab = daeSafeCast<domKinematics_bind>(ias->add(COLLADA_ELEMENT_BIND));
ab->setSymbol(str(boost::format("%s.%s")%assym%kas.axissid).c_str());
daeSafeCast<domKinematics_param>(ab->add(COLLADA_ELEMENT_PARAM))->setRef(str(boost::format("%s.%s")%asmid%kas.axissid).c_str());
string valuesid;
if( kas.valuesid.size() > 0 ) {
domKinematics_bindRef abmvalue = daeSafeCast<domKinematics_bind>(ias_motion->add(COLLADA_ELEMENT_BIND));
abmvalue->setSymbol(str(boost::format("%s.%s")%asmid%kas.valuesid).c_str());
daeSafeCast<domKinematics_param>(abmvalue->add(COLLADA_ELEMENT_PARAM))->setRef(kas.valuesid.c_str());
domKinematics_newparamRef abmvalue = daeSafeCast<domKinematics_newparam>(ias_motion->add(COLLADA_ELEMENT_NEWPARAM));
abmvalue->setSid(str(boost::format("%s.%s")%asmid%kas.valuesid).c_str());
daeSafeCast<domKinematics_newparam::domSIDREF>(abmvalue->add(COLLADA_ELEMENT_SIDREF))->setValue(kas.valuesid.c_str());
domKinematics_bindRef abvalue = daeSafeCast<domKinematics_bind>(ias->add(COLLADA_ELEMENT_BIND));
valuesid = str(boost::format("%s.%s")%assym%kas.valuesid);
abvalue->setSymbol(valuesid.c_str());
@ -521,15 +521,15 @@ protected:
_ikmout->ikm->setUrl(str(boost::format("#%s")%kmout->kmodel->getID()).c_str());
_ikmout->ikm->setSid(ikmsid.c_str());
domKinematics_bindRef kbind = daeSafeCast<domKinematics_bind>(_ikmout->ikm->add(COLLADA_ELEMENT_BIND));
kbind->setSymbol((symscope+ikmsid).c_str());
daeSafeCast<domKinematics_bind::domSIDREF>(kbind->add(COLLADA_ELEMENT_SIDREF))->setValue((refscope+ikmsid).c_str());
_ikmout->vkinematicsbindings.push_back(make_pair(string(kbind->getSymbol()), str(boost::format("visual%d/node0")%id)));
domKinematics_newparamRef kbind = daeSafeCast<domKinematics_newparam>(_ikmout->ikm->add(COLLADA_ELEMENT_NEWPARAM));
kbind->setSid((symscope+ikmsid).c_str());
daeSafeCast<domKinematics_newparam::domSIDREF>(kbind->add(COLLADA_ELEMENT_SIDREF))->setValue((refscope+ikmsid).c_str());
_ikmout->vkinematicsbindings.push_back(make_pair(string(kbind->getSid()), str(boost::format("visual%d/node0")%id)));
_ikmout->vaxissids.reserve(kmout->vaxissids.size());
int i = 0;
FOREACH(it,kmout->vaxissids) {
domKinematics_bindRef kbind = daeSafeCast<domKinematics_bind>(_ikmout->ikm->add(COLLADA_ELEMENT_BIND));
domKinematics_newparamRef kbind = daeSafeCast<domKinematics_newparam>(_ikmout->ikm->add(COLLADA_ELEMENT_NEWPARAM));
string ref = it->sid;
size_t index = ref.find("/");
while(index != string::npos) {
@ -537,8 +537,8 @@ protected:
index = ref.find("/",index+1);
}
string sid = symscope+ikmsid+"."+ref;
kbind->setSymbol(sid.c_str());
daeSafeCast<domKinematics_bind::domSIDREF>(kbind->add(COLLADA_ELEMENT_SIDREF))->setValue((refscope+ikmsid+"/"+it->sid).c_str());
kbind->setSid(sid.c_str());
daeSafeCast<domKinematics_newparam::domSIDREF>(kbind->add(COLLADA_ELEMENT_SIDREF))->setValue((refscope+ikmsid+"/"+it->sid).c_str());
double value=0;
double flower=0, fupper=0;
if( !!it->pjoint->limits ) {