Relaxed the handling of Image objects
This commit is contained in:
parent
c6e72ee00b
commit
218e36b12b
@ -268,7 +268,9 @@ inline bool PropertyInterface::getProperty(const osg::Object* object, const std:
|
|||||||
template<>
|
template<>
|
||||||
inline bool PropertyInterface::setProperty(osg::Object* object, const std::string& propertyName, const ObjectPtr& value)
|
inline bool PropertyInterface::setProperty(osg::Object* object, const std::string& propertyName, const ObjectPtr& value)
|
||||||
{
|
{
|
||||||
if (copyPropertyObjectToObject(object, propertyName, &value, sizeof(ObjectPtr), getTypeEnum<ObjectPtr>())) return true;
|
osgDB::BaseSerializer::Type type = dynamic_cast<osg::Image*>(value) ? osgDB::BaseSerializer::RW_IMAGE : getTypeEnum<ObjectPtr>();
|
||||||
|
// osgDB::BaseSerializer::Type type = getTypeEnum<ObjectPtr>();
|
||||||
|
if (copyPropertyObjectToObject(object, propertyName, &value, sizeof(ObjectPtr), type)) return true;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// fallback to using user data to store property data
|
// fallback to using user data to store property data
|
||||||
|
@ -264,6 +264,8 @@ bool PropertyInterface::areTypesCompatible(osgDB::BaseSerializer::Type lhs, osgD
|
|||||||
if (lhs==osgDB::BaseSerializer::RW_ENUM) lhs = osgDB::BaseSerializer::RW_INT;
|
if (lhs==osgDB::BaseSerializer::RW_ENUM) lhs = osgDB::BaseSerializer::RW_INT;
|
||||||
if (rhs==osgDB::BaseSerializer::RW_ENUM) rhs = osgDB::BaseSerializer::RW_INT;
|
if (rhs==osgDB::BaseSerializer::RW_ENUM) rhs = osgDB::BaseSerializer::RW_INT;
|
||||||
|
|
||||||
|
if (lhs==osgDB::BaseSerializer::RW_IMAGE) lhs = osgDB::BaseSerializer::RW_OBJECT;
|
||||||
|
|
||||||
return lhs==rhs;
|
return lhs==rhs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,7 +394,7 @@ bool PropertyInterface::copyPropertyObjectFromObject(const osg::Object* object,
|
|||||||
osgDB::BaseSerializer* serializer = getSerializer(object, propertyName, sourceType);
|
osgDB::BaseSerializer* serializer = getSerializer(object, propertyName, sourceType);
|
||||||
if (serializer)
|
if (serializer)
|
||||||
{
|
{
|
||||||
if (areTypesCompatible(valueType, sourceType))
|
if (areTypesCompatible(sourceType, valueType))
|
||||||
{
|
{
|
||||||
return serializer->get(*object, valuePtr);
|
return serializer->get(*object, valuePtr);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user