From Cedric Pinson, from three submissions:
"Here a patch that correct like the previous assign collada material name to stateset." and "I changed how the collada reader set object name in osg. Current implementation use collada ID to setup name. with this patch I use collada name to setup name in osg object and if collada provide no name I use as fallback ID. I am not sure we want this fallback. The motivation of this change is that when an artist set names to its objects and export to collada, I am not able to use those names in osg to retrieve the node." and "Here the update of the file that fix the light id stuff"
This commit is contained in:
@@ -201,6 +201,9 @@ void daeReader::processBindMaterial( domBind_material *bm, domGeometry *geom, os
|
||||
void daeReader::processMaterial(osg::StateSet *ss, domMaterial *mat )
|
||||
{
|
||||
_currentInstance_effect = mat->getInstance_effect();
|
||||
if (mat && mat->getName()) {
|
||||
ss->setName(mat->getName());
|
||||
}
|
||||
domEffect *effect = daeSafeCast< domEffect >( getElementFromURI( _currentInstance_effect->getUrl() ) );
|
||||
if (effect)
|
||||
{
|
||||
@@ -1096,11 +1099,11 @@ osg::Texture2D* daeReader::processTexture(
|
||||
parameters.wrap_t = getWrapMode(sampler->getWrap_s()->getValue());
|
||||
}
|
||||
|
||||
if (sampler->getMinfilter())
|
||||
if (sampler->getMinfilter() && sampler->getMinfilter()->getValue() != FX_SAMPLER_FILTER_COMMON_NONE)
|
||||
{
|
||||
parameters.filter_min = getFilterMode(sampler->getMinfilter()->getValue(), true);
|
||||
}
|
||||
if (sampler->getMagfilter())
|
||||
if (sampler->getMagfilter() && sampler->getMagfilter()->getValue() != FX_SAMPLER_FILTER_COMMON_NONE)
|
||||
{
|
||||
parameters.filter_mag = getFilterMode(sampler->getMagfilter()->getValue(), false);
|
||||
}
|
||||
|
||||
@@ -358,7 +358,10 @@ osg::Node* daeReader::processLight( domLight *dlight )
|
||||
|
||||
osg::LightSource* lightsource = new osg::LightSource();
|
||||
lightsource->setLight(light);
|
||||
lightsource->setName(dlight->getId());
|
||||
std::string name = dlight->getId() ? dlight->getId() : "";
|
||||
if (dlight->getName())
|
||||
name = dlight->getName();
|
||||
lightsource->setName(name);
|
||||
|
||||
daeElement *el = dlight->getTechnique_common()->getContents()[0];
|
||||
ambient = daeSafeCast< domLight::domTechnique_common::domAmbient >( el );
|
||||
|
||||
@@ -552,7 +552,12 @@ osg::Node* daeReader::processNode( domNode *node, bool skeleton)
|
||||
|
||||
if (resultNode->getName().empty())
|
||||
{
|
||||
resultNode->setName( node->getId() ? node->getId() : "" );
|
||||
std::string name = "";
|
||||
if (node->getId())
|
||||
name = node->getId();
|
||||
if (node->getName())
|
||||
name = node->getName();
|
||||
resultNode->setName( name );
|
||||
}
|
||||
|
||||
osg::Group* attachTo = resultNode;
|
||||
|
||||
Reference in New Issue
Block a user