From Marin Platings and Robert Osfield, fix of Uniform unique ID by making osg::Object::setName() virtual.

This commit is contained in:
Robert Osfield
2010-11-26 13:54:11 +00:00
parent 4820157fed
commit ebfcb17744
3 changed files with 6 additions and 6 deletions

View File

@@ -96,13 +96,13 @@ class OSG_EXPORT Object : public Referenced
/** Set the name of object using C++ style string.*/
inline void setName( const std::string& name ) { _name = name; }
virtual void setName( const std::string& name ) { _name = name; }
/** Set the name of object using a C style string.*/
inline void setName( const char* name )
{
if (name) _name = name;
else _name.clear();
if (name) setName(std::string(name));
else setName(std::string());
}
/** Get the name of object.*/

View File

@@ -241,7 +241,7 @@ class OSG_EXPORT Uniform : public Object
Type getType() const { return _type; }
/** Set the name of the glUniform, ensuring it is only set once.*/
void setName( const std::string& name );
virtual void setName( const std::string& name );
/** Set the length of a uniform, ensuring it is only set once (1==scalar)*/
void setNumElements( unsigned int numElements );

View File

@@ -88,8 +88,8 @@ void Uniform::setName( const std::string& name )
OSG_WARN << "cannot change Uniform name" << std::endl;
return;
}
_name = name;
_nameID = getNameID(name);
Object::setName(name);
_nameID = getNameID(_name);
}
void Uniform::setNumElements( unsigned int numElements )