Remove unused attribute saving and loading (#86)

This commit is contained in:
ROllerozxa
2021-12-29 23:00:56 +01:00
committed by GitHub
parent dd09fdcb4e
commit 52e03a8485
72 changed files with 21 additions and 6512 deletions

View File

@ -343,8 +343,8 @@ void CAnimatedMeshSceneNode::render()
// show normals
if (DebugDataVisible & scene::EDS_NORMALS)
{
const f32 debugNormalLength = SceneManager->getParameters()->getAttributeAsFloat(DEBUG_NORMAL_LENGTH);
const video::SColor debugNormalColor = SceneManager->getParameters()->getAttributeAsColor(DEBUG_NORMAL_COLOR);
const f32 debugNormalLength = 1.f;
const video::SColor debugNormalColor = video::SColor(255, 34, 221, 221);
const u32 count = m->getMeshBufferCount();
// draw normals
@ -652,54 +652,6 @@ bool CAnimatedMeshSceneNode::isReadOnlyMaterials() const
}
//! Writes attributes of the scene node.
void CAnimatedMeshSceneNode::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const
{
IAnimatedMeshSceneNode::serializeAttributes(out, options);
if (options && (options->Flags&io::EARWF_USE_RELATIVE_PATHS) && options->Filename)
{
const io::path path = SceneManager->getFileSystem()->getRelativeFilename(
SceneManager->getFileSystem()->getAbsolutePath(SceneManager->getMeshCache()->getMeshName(Mesh).getPath()),
options->Filename);
out->addString("Mesh", path.c_str());
}
else
out->addString("Mesh", SceneManager->getMeshCache()->getMeshName(Mesh).getPath().c_str());
out->addBool("Looping", Looping);
out->addBool("ReadOnlyMaterials", ReadOnlyMaterials);
out->addFloat("FramesPerSecond", FramesPerSecond);
out->addInt("StartFrame", StartFrame);
out->addInt("EndFrame", EndFrame);
}
//! Reads attributes of the scene node.
void CAnimatedMeshSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
{
IAnimatedMeshSceneNode::deserializeAttributes(in, options);
io::path oldMeshStr = SceneManager->getMeshCache()->getMeshName(Mesh);
io::path newMeshStr = in->getAttributeAsString("Mesh");
Looping = in->getAttributeAsBool("Looping");
ReadOnlyMaterials = in->getAttributeAsBool("ReadOnlyMaterials");
FramesPerSecond = in->getAttributeAsFloat("FramesPerSecond");
StartFrame = in->getAttributeAsInt("StartFrame");
EndFrame = in->getAttributeAsInt("EndFrame");
if (newMeshStr != "" && oldMeshStr != newMeshStr)
{
IAnimatedMesh* newAnimatedMesh = SceneManager->getMesh(newMeshStr.c_str());
if (newAnimatedMesh)
setMesh(newAnimatedMesh);
}
// TODO: read animation names instead of frame begin and ends
}
//! Sets a new mesh
void CAnimatedMeshSceneNode::setMesh(IAnimatedMesh* mesh)
{

View File

@ -114,12 +114,6 @@ namespace scene
//! Returns the current mesh
virtual IAnimatedMesh* getMesh(void) _IRR_OVERRIDE_ { return Mesh; }
//! Writes attributes of the scene node.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_;
//! Reads attributes of the scene node.
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_;
//! Returns type of the scene node
virtual ESCENE_NODE_TYPE getType() const _IRR_OVERRIDE_ { return ESNT_ANIMATED_MESH; }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -113,126 +113,9 @@ public:
//! Sets an attribute as float value
virtual void setAttribute(s32 index, f32 value) _IRR_OVERRIDE_;
/*
String Attribute
*/
//! Adds an attribute as string
virtual void addString(const c8* attributeName, const c8* value) _IRR_OVERRIDE_;
//! Sets an attribute value as string.
//! \param attributeName: Name for the attribute
//! \param value: Value for the attribute. Set this to 0 to delete the attribute
virtual void setAttribute(const c8* attributeName, const c8* value) _IRR_OVERRIDE_;
//! Gets an attribute as string.
//! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute()
//! or defaultNotFound if attribute is not set.
virtual core::stringc getAttributeAsString(const c8* attributeName, const core::stringc& defaultNotFound=core::stringc()) const _IRR_OVERRIDE_;
//! Gets an attribute as string.
//! \param attributeName: Name of the attribute to get.
//! \param target: Buffer where the string is copied to.
virtual void getAttributeAsString(const c8* attributeName, c8* target) const _IRR_OVERRIDE_;
//! Returns attribute value as string by index.
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual core::stringc getAttributeAsString(s32 index) const _IRR_OVERRIDE_;
//! Sets an attribute value as string.
//! \param attributeName: Name for the attribute
virtual void setAttribute(s32 index, const c8* value) _IRR_OVERRIDE_;
// wide strings
//! Adds an attribute as string
virtual void addString(const c8* attributeName, const wchar_t* value) _IRR_OVERRIDE_;
//! Sets an attribute value as string.
//! \param attributeName: Name for the attribute
//! \param value: Value for the attribute. Set this to 0 to delete the attribute
virtual void setAttribute(const c8* attributeName, const wchar_t* value) _IRR_OVERRIDE_;
//! Gets an attribute as string.
//! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute()
//! or defaultNotFound if attribute is not set.
virtual core::stringw getAttributeAsStringW(const c8* attributeName, const core::stringw& defaultNotFound = core::stringw()) const _IRR_OVERRIDE_;
//! Gets an attribute as string.
//! \param attributeName: Name of the attribute to get.
//! \param target: Buffer where the string is copied to.
virtual void getAttributeAsStringW(const c8* attributeName, wchar_t* target) const _IRR_OVERRIDE_;
//! Returns attribute value as string by index.
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual core::stringw getAttributeAsStringW(s32 index) const _IRR_OVERRIDE_;
//! Sets an attribute value as string.
//! \param attributeName: Name for the attribute
virtual void setAttribute(s32 index, const wchar_t* value) _IRR_OVERRIDE_;
/*
Binary Data Attribute
*/
//! Adds an attribute as binary data
virtual void addBinary(const c8* attributeName, void* data, s32 dataSizeInBytes) _IRR_OVERRIDE_;
//! Sets an attribute as binary data
virtual void setAttribute(const c8* attributeName, void* data, s32 dataSizeInBytes) _IRR_OVERRIDE_;
//! Gets an attribute as binary data
//! \param attributeName: Name of the attribute to get.
virtual void getAttributeAsBinaryData(const c8* attributeName, void* outData, s32 maxSizeInBytes) const _IRR_OVERRIDE_;
//! Gets an attribute as binary data
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual void getAttributeAsBinaryData(s32 index, void* outData, s32 maxSizeInBytes) const _IRR_OVERRIDE_;
//! Sets an attribute as binary data
virtual void setAttribute(s32 index, void* data, s32 dataSizeInBytes) _IRR_OVERRIDE_;
/*
Array Attribute
*/
//! Adds an attribute as wide string array
virtual void addArray(const c8* attributeName, const core::array<core::stringw>& value) _IRR_OVERRIDE_;
//! Sets an attribute value as a wide string array.
//! \param attributeName: Name for the attribute
//! \param value: Value for the attribute. Set this to 0 to delete the attribute
virtual void setAttribute(const c8* attributeName, const core::array<core::stringw>& value) _IRR_OVERRIDE_;
//! Gets an attribute as an array of wide strings.
//! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute()
//! or defaultNotFound if attribute is not set.
virtual core::array<core::stringw> getAttributeAsArray(const c8* attributeName, const core::array<core::stringw>& defaultNotFound = core::array<core::stringw>()) const _IRR_OVERRIDE_;
//! Returns attribute value as an array of wide strings by index.
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual core::array<core::stringw> getAttributeAsArray(s32 index) const _IRR_OVERRIDE_;
//! Sets an attribute as an array of wide strings
virtual void setAttribute(s32 index, const core::array<core::stringw>& value) _IRR_OVERRIDE_;
/*
Bool Attribute
*/
//! Adds an attribute as bool
@ -254,463 +137,6 @@ public:
//! Sets an attribute as boolean value
virtual void setAttribute(s32 index, bool value) _IRR_OVERRIDE_;
/*
Enumeration Attribute
*/
//! Adds an attribute as enum
virtual void addEnum(const c8* attributeName, const c8* enumValue, const c8* const* enumerationLiterals) _IRR_OVERRIDE_;
//! Adds an attribute as enum
virtual void addEnum(const c8* attributeName, s32 enumValue, const c8* const* enumerationLiterals) _IRR_OVERRIDE_;
//! Sets an attribute as enumeration
virtual void setAttribute(const c8* attributeName, const c8* enumValue, const c8* const* enumerationLiterals) _IRR_OVERRIDE_;
//! Gets an attribute as enumeration
//! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute()
virtual const c8* getAttributeAsEnumeration(const c8* attributeName, const c8* defaultNotFound = 0) const _IRR_OVERRIDE_;
//! Gets an attribute as enumeration
//! \param attributeName: Name of the attribute to get.
//! \param enumerationLiteralsToUse: Use these enumeration literals to get the index value instead of the set ones.
//! This is useful when the attribute list maybe was read from an xml file, and only contains the enumeration string, but
//! no information about its index.
//! \return Returns value of the attribute previously set by setAttribute()
virtual s32 getAttributeAsEnumeration(const c8* attributeName, const c8* const* enumerationLiteralsToUse, s32 defaultNotFound ) const _IRR_OVERRIDE_;
//! Gets an attribute as enumeration
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual s32 getAttributeAsEnumeration(s32 index, const c8* const* enumerationLiteralsToUse, s32 defaultNotFound) const _IRR_OVERRIDE_;
//! Gets an attribute as enumeration
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual const c8* getAttributeAsEnumeration(s32 index) const _IRR_OVERRIDE_;
//! Gets the list of enumeration literals of an enumeration attribute
//! \param attributeName: Name of the attribute to get.
virtual void getAttributeEnumerationLiteralsOfEnumeration(const c8* attributeName, core::array<core::stringc>& outLiterals) const _IRR_OVERRIDE_;
//! Gets the list of enumeration literals of an enumeration attribute
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual void getAttributeEnumerationLiteralsOfEnumeration(s32 index, core::array<core::stringc>& outLiterals) const _IRR_OVERRIDE_;
//! Sets an attribute as enumeration
virtual void setAttribute(s32 index, const c8* enumValue, const c8* const* enumerationLiterals) _IRR_OVERRIDE_;
/*
SColor Attribute
*/
//! Adds an attribute as color
virtual void addColor(const c8* attributeName, video::SColor value) _IRR_OVERRIDE_;
//! Sets a attribute as color
virtual void setAttribute(const c8* attributeName, video::SColor color) _IRR_OVERRIDE_;
//! Gets an attribute as color
//! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute()
virtual video::SColor getAttributeAsColor(const c8* attributeName, const video::SColor& defaultNotFound = video::SColor(0)) const _IRR_OVERRIDE_;
//! Gets an attribute as color
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual video::SColor getAttributeAsColor(s32 index) const _IRR_OVERRIDE_;
//! Sets an attribute as color
virtual void setAttribute(s32 index, video::SColor color) _IRR_OVERRIDE_;
/*
SColorf Attribute
*/
//! Adds an attribute as floating point color
virtual void addColorf(const c8* attributeName, video::SColorf value) _IRR_OVERRIDE_;
//! Sets a attribute as floating point color
virtual void setAttribute(const c8* attributeName, video::SColorf color) _IRR_OVERRIDE_;
//! Gets an attribute as floating point color
//! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute()
virtual video::SColorf getAttributeAsColorf(const c8* attributeName, const video::SColorf& defaultNotFound = video::SColorf(0)) const _IRR_OVERRIDE_;
//! Gets an attribute as floating point color
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual video::SColorf getAttributeAsColorf(s32 index) const _IRR_OVERRIDE_;
//! Sets an attribute as floating point color
virtual void setAttribute(s32 index, video::SColorf color) _IRR_OVERRIDE_;
/*
Vector3d Attribute
*/
//! Adds an attribute as 3d vector
virtual void addVector3d(const c8* attributeName, const core::vector3df& value) _IRR_OVERRIDE_;
//! Sets a attribute as 3d vector
virtual void setAttribute(const c8* attributeName, const core::vector3df& v) _IRR_OVERRIDE_;
//! Gets an attribute as 3d vector
//! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute()
virtual core::vector3df getAttributeAsVector3d(const c8* attributeName, const core::vector3df& defaultNotFound=core::vector3df(0,0,0)) const _IRR_OVERRIDE_;
//! Gets an attribute as 3d vector
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual core::vector3df getAttributeAsVector3d(s32 index) const _IRR_OVERRIDE_;
//! Sets an attribute as vector
virtual void setAttribute(s32 index, const core::vector3df& v) _IRR_OVERRIDE_;
/*
Vector2d Attribute
*/
//! Adds an attribute as 2d vector
virtual void addVector2d(const c8* attributeName, const core::vector2df& value) _IRR_OVERRIDE_;
//! Sets a attribute as 2d vector
virtual void setAttribute(const c8* attributeName, const core::vector2df& v) _IRR_OVERRIDE_;
//! Gets an attribute as 2d vector
//! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute()
virtual core::vector2df getAttributeAsVector2d(const c8* attributeName, const core::vector2df& defaultNotFound=core::vector2df(0,0)) const _IRR_OVERRIDE_;
//! Gets an attribute as 3d vector
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual core::vector2df getAttributeAsVector2d(s32 index) const _IRR_OVERRIDE_;
//! Sets an attribute as vector
virtual void setAttribute(s32 index, const core::vector2df& v) _IRR_OVERRIDE_;
/*
Position2d Attribute
*/
//! Adds an attribute as 2d position
virtual void addPosition2d(const c8* attributeName, const core::position2di& value) _IRR_OVERRIDE_;
//! Sets a attribute as 2d position
virtual void setAttribute(const c8* attributeName, const core::position2di& v) _IRR_OVERRIDE_;
//! Gets an attribute as position
//! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute()
virtual core::position2di getAttributeAsPosition2d(const c8* attributeName, const core::position2di& defaultNotFound=core::position2di(0,0)) const _IRR_OVERRIDE_;
//! Gets an attribute as position
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual core::position2di getAttributeAsPosition2d(s32 index) const _IRR_OVERRIDE_;
//! Sets an attribute as 2d position
virtual void setAttribute(s32 index, const core::position2di& v) _IRR_OVERRIDE_;
/*
Rectangle Attribute
*/
//! Adds an attribute as rectangle
virtual void addRect(const c8* attributeName, const core::rect<s32>& value) _IRR_OVERRIDE_;
//! Sets an attribute as rectangle
virtual void setAttribute(const c8* attributeName, const core::rect<s32>& v) _IRR_OVERRIDE_;
//! Gets an attribute as rectangle
//! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute()
virtual core::rect<s32> getAttributeAsRect(const c8* attributeName, const core::rect<s32>& defaultNotFound = core::rect<s32>()) const _IRR_OVERRIDE_;
//! Gets an attribute as rectangle
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual core::rect<s32> getAttributeAsRect(s32 index) const _IRR_OVERRIDE_;
//! Sets an attribute as rectangle
virtual void setAttribute(s32 index, const core::rect<s32>& v) _IRR_OVERRIDE_;
/*
Dimension2d Attribute
*/
//! Adds an attribute as dimension2d
virtual void addDimension2d(const c8* attributeName, const core::dimension2d<u32>& value) _IRR_OVERRIDE_;
//! Sets an attribute as dimension2d
virtual void setAttribute(const c8* attributeName, const core::dimension2d<u32>& v) _IRR_OVERRIDE_;
//! Gets an attribute as dimension2d
//! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute()
virtual core::dimension2d<u32> getAttributeAsDimension2d(const c8* attributeName, const core::dimension2d<u32>& defaultNotFound = core::dimension2d<u32>()) const _IRR_OVERRIDE_;
//! Gets an attribute as dimension2d
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual core::dimension2d<u32> getAttributeAsDimension2d(s32 index) const _IRR_OVERRIDE_;
//! Sets an attribute as dimension2d
virtual void setAttribute(s32 index, const core::dimension2d<u32>& v) _IRR_OVERRIDE_;
/*
matrix attribute
*/
//! Adds an attribute as matrix
virtual void addMatrix(const c8* attributeName, const core::matrix4& v) _IRR_OVERRIDE_;
//! Sets an attribute as matrix
virtual void setAttribute(const c8* attributeName, const core::matrix4& v) _IRR_OVERRIDE_;
//! Gets an attribute as a matrix4
//! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute()
virtual core::matrix4 getAttributeAsMatrix(const c8* attributeName, const core::matrix4& defaultNotFound=core::matrix4()) const _IRR_OVERRIDE_;
//! Gets an attribute as matrix
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual core::matrix4 getAttributeAsMatrix(s32 index) const _IRR_OVERRIDE_;
//! Sets an attribute as matrix
virtual void setAttribute(s32 index, const core::matrix4& v) _IRR_OVERRIDE_;
/*
quaternion attribute
*/
//! Adds an attribute as quaternion
virtual void addQuaternion(const c8* attributeName, const core::quaternion& v) _IRR_OVERRIDE_;
//! Sets an attribute as quaternion
virtual void setAttribute(const c8* attributeName, const core::quaternion& v) _IRR_OVERRIDE_;
//! Gets an attribute as a quaternion
//! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute()
virtual core::quaternion getAttributeAsQuaternion(const c8* attributeName, const core::quaternion& defaultNotFound=core::quaternion(0,1,0, 0)) const _IRR_OVERRIDE_;
//! Gets an attribute as quaternion
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual core::quaternion getAttributeAsQuaternion(s32 index) const _IRR_OVERRIDE_;
//! Sets an attribute as quaternion
virtual void setAttribute(s32 index, const core::quaternion& v) _IRR_OVERRIDE_;
/*
3d bounding box
*/
//! Adds an attribute as axis aligned bounding box
virtual void addBox3d(const c8* attributeName, const core::aabbox3df& v) _IRR_OVERRIDE_;
//! Sets an attribute as axis aligned bounding box
virtual void setAttribute(const c8* attributeName, const core::aabbox3df& v) _IRR_OVERRIDE_;
//! Gets an attribute as a axis aligned bounding box
//! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute()
virtual core::aabbox3df getAttributeAsBox3d(const c8* attributeName, const core::aabbox3df& defaultNotFound=core::aabbox3df(0,0,0, 0,0,0)) const _IRR_OVERRIDE_;
//! Gets an attribute as axis aligned bounding box
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual core::aabbox3df getAttributeAsBox3d(s32 index) const _IRR_OVERRIDE_;
//! Sets an attribute as axis aligned bounding box
virtual void setAttribute(s32 index, const core::aabbox3df& v) _IRR_OVERRIDE_;
/*
plane
*/
//! Adds an attribute as 3d plane
virtual void addPlane3d(const c8* attributeName, const core::plane3df& v) _IRR_OVERRIDE_;
//! Sets an attribute as 3d plane
virtual void setAttribute(const c8* attributeName, const core::plane3df& v) _IRR_OVERRIDE_;
//! Gets an attribute as a 3d plane
//! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute()
virtual core::plane3df getAttributeAsPlane3d(const c8* attributeName, const core::plane3df& defaultNotFound=core::plane3df(0,0,0, 0,1,0)) const _IRR_OVERRIDE_;
//! Gets an attribute as 3d plane
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual core::plane3df getAttributeAsPlane3d(s32 index) const _IRR_OVERRIDE_;
//! Sets an attribute as 3d plane
virtual void setAttribute(s32 index, const core::plane3df& v) _IRR_OVERRIDE_;
/*
3d triangle
*/
//! Adds an attribute as 3d triangle
virtual void addTriangle3d(const c8* attributeName, const core::triangle3df& v) _IRR_OVERRIDE_;
//! Sets an attribute as 3d triangle
virtual void setAttribute(const c8* attributeName, const core::triangle3df& v) _IRR_OVERRIDE_;
//! Gets an attribute as a 3d triangle
//! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute()
virtual core::triangle3df getAttributeAsTriangle3d(const c8* attributeName, const core::triangle3df& defaultNotFound = core::triangle3df(core::vector3df(0,0,0), core::vector3df(0,0,0), core::vector3df(0,0,0))) const _IRR_OVERRIDE_;
//! Gets an attribute as 3d triangle
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual core::triangle3df getAttributeAsTriangle3d(s32 index) const _IRR_OVERRIDE_;
//! Sets an attribute as 3d triangle
virtual void setAttribute(s32 index, const core::triangle3df& v) _IRR_OVERRIDE_;
/*
line 2d
*/
//! Adds an attribute as a 2d line
virtual void addLine2d(const c8* attributeName, const core::line2df& v) _IRR_OVERRIDE_;
//! Sets an attribute as a 2d line
virtual void setAttribute(const c8* attributeName, const core::line2df& v) _IRR_OVERRIDE_;
//! Gets an attribute as a 2d line
//! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute()
virtual core::line2df getAttributeAsLine2d(const c8* attributeName, const core::line2df& defaultNotFound = core::line2df(0,0, 0,0)) const _IRR_OVERRIDE_;
//! Gets an attribute as a 2d line
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual core::line2df getAttributeAsLine2d(s32 index) const _IRR_OVERRIDE_;
//! Sets an attribute as a 2d line
virtual void setAttribute(s32 index, const core::line2df& v) _IRR_OVERRIDE_;
/*
line 3d
*/
//! Adds an attribute as a 3d line
virtual void addLine3d(const c8* attributeName, const core::line3df& v) _IRR_OVERRIDE_;
//! Sets an attribute as a 3d line
virtual void setAttribute(const c8* attributeName, const core::line3df& v) _IRR_OVERRIDE_;
//! Gets an attribute as a 3d line
//! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute()
virtual core::line3df getAttributeAsLine3d(const c8* attributeName, const core::line3df& defaultNotFound=core::line3df(0,0,0, 0,0,0)) const _IRR_OVERRIDE_;
//! Gets an attribute as a 3d line
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual core::line3df getAttributeAsLine3d(s32 index) const _IRR_OVERRIDE_;
//! Sets an attribute as a 3d line
virtual void setAttribute(s32 index, const core::line3df& v) _IRR_OVERRIDE_;
/*
Texture Attribute
*/
//! Adds an attribute as texture reference
virtual void addTexture(const c8* attributeName, video::ITexture* texture, const io::path& filename = "") _IRR_OVERRIDE_;
//! Sets an attribute as texture reference
virtual void setAttribute(const c8* attributeName, video::ITexture* texture, const io::path& filename = "") _IRR_OVERRIDE_;
//! Gets an attribute as texture reference
//! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
virtual video::ITexture* getAttributeAsTexture(const c8* attributeName, video::ITexture* defaultNotFound=0) const _IRR_OVERRIDE_;
//! Gets an attribute as texture reference
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual video::ITexture* getAttributeAsTexture(s32 index) const _IRR_OVERRIDE_;
//! Sets an attribute as texture reference
virtual void setAttribute(s32 index, video::ITexture* texture, const io::path& filename = "") _IRR_OVERRIDE_;
/*
User Pointer Attribute
*/
//! Adds an attribute as user pointer
virtual void addUserPointer(const c8* attributeName, void* userPointer) _IRR_OVERRIDE_;
//! Sets an attribute as user pointer
virtual void setAttribute(const c8* attributeName, void* userPointer) _IRR_OVERRIDE_;
//! Gets an attribute as user pointer
//! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
virtual void* getAttributeAsUserPointer(const c8* attributeName, void* defaultNotFound = 0) const _IRR_OVERRIDE_;
//! Gets an attribute as user pointer
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual void* getAttributeAsUserPointer(s32 index) const _IRR_OVERRIDE_;
//! Sets an attribute as user pointer
virtual void setAttribute(s32 index, void* userPointer) _IRR_OVERRIDE_;
protected:
core::array<IAttribute*> Attributes;

View File

@ -220,42 +220,6 @@ void CBillboardSceneNode::getSize(f32& height, f32& bottomEdgeWidth,
}
//! Writes attributes of the scene node.
void CBillboardSceneNode::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const
{
IBillboardSceneNode::serializeAttributes(out, options);
out->addFloat("Width", Size.Width);
out->addFloat("TopEdgeWidth", TopEdgeWidth);
out->addFloat("Height", Size.Height);
out->addColor("Shade_Top", Buffer->Vertices[1].Color);
out->addColor("Shade_Down", Buffer->Vertices[0].Color);
}
//! Reads attributes of the scene node.
void CBillboardSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
{
IBillboardSceneNode::deserializeAttributes(in, options);
Size.Width = in->getAttributeAsFloat("Width");
Size.Height = in->getAttributeAsFloat("Height");
if (in->existsAttribute("TopEdgeWidth"))
{
TopEdgeWidth = in->getAttributeAsFloat("TopEdgeWidth");
if (Size.Width != TopEdgeWidth)
setSize(Size.Height, Size.Width, TopEdgeWidth);
}
else
setSize(Size);
Buffer->Vertices[1].Color = in->getAttributeAsColor("Shade_Top");
Buffer->Vertices[0].Color = in->getAttributeAsColor("Shade_Down");
Buffer->Vertices[2].Color = Buffer->Vertices[1].Color;
Buffer->Vertices[3].Color = Buffer->Vertices[0].Color;
}
//! Set the color of all vertices of the billboard
//! \param overallColor: the color to set
void CBillboardSceneNode::setColor(const video::SColor& overallColor)

View File

@ -72,12 +72,6 @@ public:
//! Get the real boundingbox used by the billboard (which depends on the active camera)
virtual const core::aabbox3d<f32>& getTransformedBillboardBoundingBox(const irr::scene::ICameraSceneNode* camera) _IRR_OVERRIDE_;
//! Writes attributes of the scene node.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_;
//! Reads attributes of the scene node.
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_;
//! Returns type of the scene node
virtual ESCENE_NODE_TYPE getType() const _IRR_OVERRIDE_ { return ESNT_BILLBOARD; }

View File

@ -96,26 +96,6 @@ void CBoneSceneNode::updateAbsolutePositionOfAllChildren()
}
void CBoneSceneNode::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const
{
IBoneSceneNode::serializeAttributes(out, options);
out->addInt("BoneIndex", BoneIndex);
out->addEnum("AnimationMode", AnimationMode, BoneAnimationModeNames);
}
void CBoneSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
{
BoneIndex = in->getAttributeAsInt("BoneIndex");
AnimationMode = (E_BONE_ANIMATION_MODE)in->getAttributeAsEnumeration("AnimationMode", BoneAnimationModeNames);
// for legacy files (before 1.5)
const core::stringc boneName = in->getAttributeAsString("BoneName");
setName(boneName);
IBoneSceneNode::deserializeAttributes(in, options);
// TODO: add/replace bone in parent with bone from mesh
}
} // namespace scene
} // namespace irr

View File

@ -43,12 +43,6 @@ namespace scene
virtual void updateAbsolutePositionOfAllChildren() _IRR_OVERRIDE_;
//! Writes attributes of the scene node.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_;
//! Reads attributes of the scene node.
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_;
//! How the relative transformation of the bone is used
virtual void setSkinningSpace(E_BONE_SKINNING_SPACE space) _IRR_OVERRIDE_
{

View File

@ -300,41 +300,6 @@ void CCameraSceneNode::recalculateViewArea()
}
//! Writes attributes of the scene node.
void CCameraSceneNode::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const
{
ICameraSceneNode::serializeAttributes(out, options);
out->addVector3d("Target", Target);
out->addVector3d("UpVector", UpVector);
out->addFloat("Fovy", Fovy);
out->addFloat("Aspect", Aspect);
out->addFloat("ZNear", ZNear);
out->addFloat("ZFar", ZFar);
out->addBool("Binding", TargetAndRotationAreBound);
out->addBool("ReceiveInput", InputReceiverEnabled);
}
//! Reads attributes of the scene node.
void CCameraSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
{
ICameraSceneNode::deserializeAttributes(in, options);
Target = in->getAttributeAsVector3d("Target");
UpVector = in->getAttributeAsVector3d("UpVector");
Fovy = in->getAttributeAsFloat("Fovy");
Aspect = in->getAttributeAsFloat("Aspect");
ZNear = in->getAttributeAsFloat("ZNear");
ZFar = in->getAttributeAsFloat("ZFar");
TargetAndRotationAreBound = in->getAttributeAsBool("Binding");
if ( in->findAttribute("ReceiveInput") )
InputReceiverEnabled = in->getAttributeAsBool("ReceiveInput");
recalculateProjectionMatrix();
recalculateViewArea();
}
//! Set the binding between the camera's rotation adn target.
void CCameraSceneNode::bindTargetAndRotation(bool bound)
{

View File

@ -130,12 +130,6 @@ namespace scene
//! Returns if the input receiver of the camera is currently enabled.
virtual bool isInputReceiverEnabled() const _IRR_OVERRIDE_;
//! Writes attributes of the scene node.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_;
//! Reads attributes of the scene node.
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_;
//! Returns type of the scene node
virtual ESCENE_NODE_TYPE getType() const _IRR_OVERRIDE_ { return ESNT_CAMERA; }

View File

@ -12,7 +12,6 @@
#include "CFileList.h"
#include "stdio.h"
#include "os.h"
#include "CAttributes.h"
#include "CReadFile.h"
#include "CMemoryFile.h"
#include "CLimitReadFile.h"
@ -939,12 +938,5 @@ IFileSystem* createFileSystem()
}
//! Creates a new empty collection of attributes, usable for serialization and more.
IAttributes* CFileSystem::createEmptyAttributes(video::IVideoDriver* driver)
{
return new CAttributes(driver);
}
} // end namespace irr
} // end namespace io

View File

@ -127,9 +127,6 @@ public:
//! determines if a file exists and would be able to be opened.
virtual bool existFile(const io::path& filename) const _IRR_OVERRIDE_;
//! Creates a new empty collection of attributes, usable for serialization and more.
virtual IAttributes* createEmptyAttributes(video::IVideoDriver* driver) _IRR_OVERRIDE_;
private:
// don't expose, needs refactoring

View File

@ -556,103 +556,6 @@ bool CGUIButton::isDrawingBorder() const
}
//! Writes attributes of the element.
void CGUIButton::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
{
IGUIButton::serializeAttributes(out,options);
out->addBool ("PushButton", IsPushButton );
if (IsPushButton)
out->addBool("Pressed", Pressed);
for ( u32 i=0; i<(u32)EGBIS_COUNT; ++i )
{
if ( ButtonImages[i].Texture )
{
core::stringc name( GUIButtonImageStateNames[i] );
out->addTexture(name.c_str(), ButtonImages[i].Texture);
name += "Rect";
out->addRect(name.c_str(), ButtonImages[i].SourceRect);
}
}
out->addBool ("UseAlphaChannel", UseAlphaChannel);
out->addBool ("Border", DrawBorder);
out->addBool ("ScaleImage", ScaleImage);
for ( u32 i=0; i<(u32)EGBS_COUNT; ++i )
{
if ( ButtonSprites[i].Index >= 0 )
{
core::stringc nameIndex( GUIButtonStateNames[i] );
nameIndex += "Index";
out->addInt(nameIndex.c_str(), ButtonSprites[i].Index );
core::stringc nameColor( GUIButtonStateNames[i] );
nameColor += "Color";
out->addColor(nameColor.c_str(), ButtonSprites[i].Color );
core::stringc nameLoop( GUIButtonStateNames[i] );
nameLoop += "Loop";
out->addBool(nameLoop.c_str(), ButtonSprites[i].Loop );
core::stringc nameScale( GUIButtonStateNames[i] );
nameScale += "Scale";
out->addBool(nameScale.c_str(), ButtonSprites[i].Scale );
}
}
// out->addString ("OverrideFont", OverrideFont);
}
//! Reads attributes of the element
void CGUIButton::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{
IGUIButton::deserializeAttributes(in,options);
IsPushButton = in->getAttributeAsBool("PushButton", IsPushButton);
Pressed = IsPushButton ? in->getAttributeAsBool("Pressed", Pressed) : false;
for ( u32 i=0; i<(u32)EGBIS_COUNT; ++i )
{
core::stringc nameRect( GUIButtonImageStateNames[i] );
nameRect += "Rect";
setImage((EGUI_BUTTON_IMAGE_STATE)i,
in->getAttributeAsTexture(GUIButtonImageStateNames[i], ButtonImages[i].Texture),
in->getAttributeAsRect(nameRect.c_str(), ButtonImages[i].SourceRect) );
}
setDrawBorder(in->getAttributeAsBool("Border", DrawBorder));
setUseAlphaChannel(in->getAttributeAsBool("UseAlphaChannel", UseAlphaChannel));
setScaleImage(in->getAttributeAsBool("ScaleImage", ScaleImage));
for ( u32 i=0; i<(u32)EGBS_COUNT; ++i )
{
core::stringc nameIndex( GUIButtonStateNames[i] );
nameIndex += "Index";
ButtonSprites[i].Index = in->getAttributeAsInt(nameIndex.c_str(), ButtonSprites[i].Index );
core::stringc nameColor( GUIButtonStateNames[i] );
nameColor += "Color";
ButtonSprites[i].Color = in->getAttributeAsColor(nameColor.c_str(), ButtonSprites[i].Color );
core::stringc nameLoop( GUIButtonStateNames[i] );
nameLoop += "Loop";
ButtonSprites[i].Loop = in->getAttributeAsBool(nameLoop.c_str(), ButtonSprites[i].Loop );
core::stringc nameScale( GUIButtonStateNames[i] );
nameScale += "Scale";
ButtonSprites[i].Scale = in->getAttributeAsBool(nameScale.c_str(), ButtonSprites[i].Scale );
}
// setOverrideFont(in->getAttributeAsString("OverrideFont"));
updateAbsolutePosition();
}
} // end namespace gui
} // end namespace irr

View File

@ -155,12 +155,6 @@ namespace gui
return ClickControlState;
}
//! Writes attributes of the element.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_;
//! Reads attributes of the element
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_;
protected:
void drawSprite(EGUI_BUTTON_STATE state, u32 startTime, const core::position2di& center);
EGUI_BUTTON_IMAGE_STATE getImageState(bool pressed) const;

View File

@ -225,28 +225,6 @@ bool CGUICheckBox::isDrawBorderEnabled() const
}
//! Writes attributes of the element.
void CGUICheckBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
{
IGUICheckBox::serializeAttributes(out,options);
out->addBool("Checked", Checked);
out->addBool("Border", Border);
out->addBool("Background", Background);
}
//! Reads attributes of the element
void CGUICheckBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{
Checked = in->getAttributeAsBool ("Checked");
Border = in->getAttributeAsBool ("Border", Border);
Background = in->getAttributeAsBool ("Background", Background);
IGUICheckBox::deserializeAttributes(in,options);
}
} // end namespace gui
} // end namespace irr

View File

@ -48,12 +48,6 @@ namespace gui
//! draws the element and its children
virtual void draw() _IRR_OVERRIDE_;
//! Writes attributes of the element.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_;
//! Reads attributes of the element
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_;
private:
u32 CheckTime;

View File

@ -486,52 +486,6 @@ void CGUIComboBox::openCloseMenu()
}
//! Writes attributes of the element.
void CGUIComboBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
{
IGUIComboBox::serializeAttributes(out,options);
out->addEnum ("HTextAlign", HAlign, GUIAlignmentNames);
out->addEnum ("VTextAlign", VAlign, GUIAlignmentNames);
out->addInt("MaxSelectionRows", (s32)MaxSelectionRows );
out->addInt ("Selected", Selected );
out->addInt ("ItemCount", Items.size());
for (u32 i=0; i < Items.size(); ++i)
{
core::stringc s = "Item";
s += i;
s += "Text";
out->addString(s.c_str(), Items[i].Name.c_str());
}
}
//! Reads attributes of the element
void CGUIComboBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{
IGUIComboBox::deserializeAttributes(in,options);
setTextAlignment( (EGUI_ALIGNMENT) in->getAttributeAsEnumeration("HTextAlign", GUIAlignmentNames),
(EGUI_ALIGNMENT) in->getAttributeAsEnumeration("VTextAlign", GUIAlignmentNames));
setMaxSelectionRows( (u32)(in->getAttributeAsInt("MaxSelectionRows")) );
// clear the list
clear();
// get item count
u32 c = in->getAttributeAsInt("ItemCount");
// add items
for (u32 i=0; i < c; ++i)
{
core::stringc s = "Item";
s += i;
s += "Text";
addItem(in->getAttributeAsStringW(s.c_str()).c_str(), 0);
}
setSelected(in->getAttributeAsInt("Selected"));
}
} // end namespace gui
} // end namespace irr

View File

@ -74,12 +74,6 @@ namespace gui
//! draws the element and its children
virtual void draw() _IRR_OVERRIDE_;
//! Writes attributes of the element.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_;
//! Reads attributes of the element
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_;
private:
void openCloseMenu();

View File

@ -735,113 +735,6 @@ void CGUIContextMenu::setItemCommandId(u32 idx, s32 id)
}
//! Writes attributes of the element.
void CGUIContextMenu::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
{
IGUIElement::serializeAttributes(out,options);
out->addPosition2d("Position", Pos);
if (Parent->getType() == EGUIET_CONTEXT_MENU || Parent->getType() == EGUIET_MENU )
{
const IGUIContextMenu* const ptr = (const IGUIContextMenu*)Parent;
// find the position of this item in its parent's list
u32 i;
// VC6 needs the cast for this
for (i=0; (i<ptr->getItemCount()) && (ptr->getSubMenu(i) != (const IGUIContextMenu*)this); ++i)
; // do nothing
out->addInt("ParentItem", i);
}
out->addInt("CloseHandling", (s32)CloseHandling);
// write out the item list
out->addInt("ItemCount", Items.size());
core::stringc tmp;
for (u32 i=0; i < Items.size(); ++i)
{
tmp = "IsSeparator"; tmp += i;
out->addBool(tmp.c_str(), Items[i].IsSeparator);
if (!Items[i].IsSeparator)
{
tmp = "Text"; tmp += i;
out->addString(tmp.c_str(), Items[i].Text.c_str());
tmp = "CommandID"; tmp += i;
out->addInt(tmp.c_str(), Items[i].CommandId);
tmp = "Enabled"; tmp += i;
out->addBool(tmp.c_str(), Items[i].Enabled);
tmp = "Checked"; tmp += i;
out->addBool(tmp.c_str(), Items[i].Checked);
tmp = "AutoChecking"; tmp += i;
out->addBool(tmp.c_str(), Items[i].AutoChecking);
}
}
}
//! Reads attributes of the element
void CGUIContextMenu::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{
IGUIElement::deserializeAttributes(in,options);
Pos = in->getAttributeAsPosition2d("Position");
// link to this item's parent
if (Parent && ( Parent->getType() == EGUIET_CONTEXT_MENU || Parent->getType() == EGUIET_MENU ) )
((CGUIContextMenu*)Parent)->setSubMenu(in->getAttributeAsInt("ParentItem"),this);
CloseHandling = (ECONTEXT_MENU_CLOSE)in->getAttributeAsInt("CloseHandling");
removeAllItems();
// read the item list
const s32 count = in->getAttributeAsInt("ItemCount");
for (s32 i=0; i<count; ++i)
{
core::stringc tmp;
core::stringw txt;
s32 commandid=-1;
bool enabled=true;
bool checked=false;
bool autochecking=false;
tmp = "IsSeparator"; tmp += i;
if ( in->existsAttribute(tmp.c_str()) && in->getAttributeAsBool(tmp.c_str()) )
addSeparator();
else
{
tmp = "Text"; tmp += i;
if ( in->existsAttribute(tmp.c_str()) )
txt = in->getAttributeAsStringW(tmp.c_str());
tmp = "CommandID"; tmp += i;
if ( in->existsAttribute(tmp.c_str()) )
commandid = in->getAttributeAsInt(tmp.c_str());
tmp = "Enabled"; tmp += i;
if ( in->existsAttribute(tmp.c_str()) )
enabled = in->getAttributeAsBool(tmp.c_str());
tmp = "Checked"; tmp += i;
if ( in->existsAttribute(tmp.c_str()) )
checked = in->getAttributeAsBool(tmp.c_str());
tmp = "AutoChecking"; tmp += i;
if ( in->existsAttribute(tmp.c_str()) )
autochecking = in->getAttributeAsBool(tmp.c_str());
addItem(core::stringw(txt.c_str()).c_str(), commandid, enabled, false, checked, autochecking);
}
}
recalculateSize();
}
// because sometimes the element has no parent at click time
void CGUIContextMenu::setEventParent(IGUIElement *parent)
{

View File

@ -112,12 +112,6 @@ namespace gui
//! When an eventparent is set it receives events instead of the usual parent element
virtual void setEventParent(IGUIElement *parent) _IRR_OVERRIDE_;
//! Writes attributes of the element.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_;
//! Reads attributes of the element
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_;
protected:
void closeAllSubMenus();

View File

@ -1650,60 +1650,6 @@ bool CGUIEditBox::acceptsIME()
return isEnabled();
}
//! Writes attributes of the element.
void CGUIEditBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
{
// IGUIEditBox::serializeAttributes(out,options);
out->addBool ("Border", Border);
out->addBool ("Background", Background);
out->addBool ("OverrideColorEnabled", OverrideColorEnabled );
out->addColor ("OverrideColor", OverrideColor);
// out->addFont("OverrideFont", OverrideFont);
out->addInt ("MaxChars", Max);
out->addBool ("WordWrap", WordWrap);
out->addBool ("MultiLine", MultiLine);
out->addBool ("AutoScroll", AutoScroll);
out->addBool ("PasswordBox", PasswordBox);
core::stringw ch = L" ";
ch[0] = PasswordChar;
out->addString("PasswordChar", ch.c_str());
out->addEnum ("HTextAlign", HAlign, GUIAlignmentNames);
out->addEnum ("VTextAlign", VAlign, GUIAlignmentNames);
IGUIEditBox::serializeAttributes(out,options);
}
//! Reads attributes of the element
void CGUIEditBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{
IGUIEditBox::deserializeAttributes(in,options);
setDrawBorder( in->getAttributeAsBool("Border", Border) );
setDrawBackground( in->getAttributeAsBool("Background", Background) );
setOverrideColor(in->getAttributeAsColor("OverrideColor", OverrideColor));
enableOverrideColor(in->getAttributeAsBool("OverrideColorEnabled", OverrideColorEnabled));
setMax(in->getAttributeAsInt("MaxChars", Max));
setWordWrap(in->getAttributeAsBool("WordWrap", WordWrap));
setMultiLine(in->getAttributeAsBool("MultiLine", MultiLine));
setAutoScroll(in->getAttributeAsBool("AutoScroll", AutoScroll));
core::stringw ch = L" ";
ch[0] = PasswordChar;
ch = in->getAttributeAsStringW("PasswordChar", ch);
if (!ch.size())
setPasswordBox(in->getAttributeAsBool("PasswordBox", PasswordBox));
else
setPasswordBox(in->getAttributeAsBool("PasswordBox", PasswordBox), ch[0]);
setTextAlignment( (EGUI_ALIGNMENT) in->getAttributeAsEnumeration("HTextAlign", GUIAlignmentNames, (s32)HAlign),
(EGUI_ALIGNMENT) in->getAttributeAsEnumeration("VTextAlign", GUIAlignmentNames, (s32)VAlign));
// setOverrideFont(in->getAttributeAsFont("OverrideFont"));
}
} // end namespace gui
} // end namespace irr

View File

@ -142,13 +142,6 @@ namespace gui
//! Returns whether the element takes input from the IME
virtual bool acceptsIME() _IRR_OVERRIDE_;
//! Writes attributes of the element.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_;
//! Reads attributes of the element
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_;
protected:
//! Breaks the single text line.
void breakText();

View File

@ -811,49 +811,6 @@ bool CGUIEnvironment::loadGUI(io::IReadFile* file, IGUIElement* parent)
return false;
}
//! Writes attributes of the environment
void CGUIEnvironment::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const
{
IGUISkin* skin = getSkin();
if (skin)
{
out->addEnum("Skin", getSkin()->getType(), GUISkinTypeNames);
skin->serializeAttributes(out, options);
}
}
//! Reads attributes of the environment
void CGUIEnvironment::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
{
if (in->existsAttribute("Skin"))
{
IGUISkin *skin = getSkin();
EGUI_SKIN_TYPE t = (EGUI_SKIN_TYPE) in->getAttributeAsEnumeration("Skin",GUISkinTypeNames);
if ( !skin || t != skin->getType())
{
skin = createSkin(t);
setSkin(skin);
skin->drop();
}
skin = getSkin();
if (skin)
{
skin->deserializeAttributes(in, options);
}
}
RelativeRect = AbsoluteRect =
core::rect<s32>(Driver ? core::dimension2di(Driver->getScreenSize()) : core::dimension2d<s32>(0,0));
}
//! adds a button. The returned pointer must not be dropped.
IGUIButton* CGUIEnvironment::addButton(const core::rect<s32>& rectangle, IGUIElement* parent, s32 id, const wchar_t* text, const wchar_t *tooltiptext)
{

View File

@ -248,12 +248,6 @@ public:
if not specified, the root element will be used */
virtual bool loadGUI(io::IReadFile* file, IGUIElement* parent=0) _IRR_OVERRIDE_;
//! Writes attributes of the environment
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_;
//! Reads attributes of the environment.
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_;
//! Find the next element which would be selected when pressing the tab-key
virtual IGUIElement* getNextElement(bool reverse=false, bool group=false) _IRR_OVERRIDE_;

View File

@ -348,36 +348,6 @@ void CGUIFileOpenDialog::draw()
IGUIElement::draw();
}
//! Writes attributes of the element.
/* Not sure if this will really work out properly. Saving paths can be
rather problematic. */
void CGUIFileOpenDialog::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const
{
IGUIFileOpenDialog::serializeAttributes(out,options);
out->addString("StartDirectory", StartDirectory.c_str());
out->addBool("RestoreDirectory", (RestoreDirectory.size()!=0));
}
//! Reads attributes of the element
/* Note that these paths changes will happen at arbitrary places upon
load of the gui description. This may be undesired. */
void CGUIFileOpenDialog::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
{
StartDirectory = in->getAttributeAsString("StartDirectory");
const bool restore = in->getAttributeAsBool("RestoreDirectory");
if (restore)
RestoreDirectory = FileSystem->getWorkingDirectory();
else
RestoreDirectory = "";
if (StartDirectory.size())
FileSystem->changeWorkingDirectoryTo(StartDirectory);
IGUIFileOpenDialog::deserializeAttributes(in,options);
}
void CGUIFileOpenDialog::pathToStringW(irr::core::stringw& result, const irr::io::path& p)
{
core::multibyteToWString(result, p);

View File

@ -49,9 +49,6 @@ namespace gui
//! draws the element and its children
virtual void draw() _IRR_OVERRIDE_;
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_;
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_;
protected:
void setFileName(const irr::io::path& name);

View File

@ -174,44 +174,6 @@ core::rect<f32> CGUIImage::getDrawBounds() const
return DrawBounds;
}
//! Writes attributes of the element.
void CGUIImage::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
{
IGUIImage::serializeAttributes(out,options);
out->addTexture ("Texture", Texture);
out->addBool ("UseAlphaChannel", UseAlphaChannel);
out->addColor ("Color", Color);
out->addBool ("ScaleImage", ScaleImage);
out->addRect ("SourceRect", SourceRect);
out->addFloat ("DrawBoundsX1", DrawBounds.UpperLeftCorner.X);
out->addFloat ("DrawBoundsY1", DrawBounds.UpperLeftCorner.Y);
out->addFloat ("DrawBoundsX2", DrawBounds.LowerRightCorner.X);
out->addFloat ("DrawBoundsY2", DrawBounds.LowerRightCorner.Y);
out->addBool ("DrawBackground", DrawBackground);
}
//! Reads attributes of the element
void CGUIImage::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{
IGUIImage::deserializeAttributes(in,options);
setImage(in->getAttributeAsTexture("Texture", Texture));
setUseAlphaChannel(in->getAttributeAsBool("UseAlphaChannel", UseAlphaChannel));
setColor(in->getAttributeAsColor("Color", Color));
setScaleImage(in->getAttributeAsBool("ScaleImage", ScaleImage));
setSourceRect(in->getAttributeAsRect("SourceRect", SourceRect));
DrawBounds.UpperLeftCorner.X = in->getAttributeAsFloat("DrawBoundsX1", DrawBounds.UpperLeftCorner.X);
DrawBounds.UpperLeftCorner.Y = in->getAttributeAsFloat("DrawBoundsY1", DrawBounds.UpperLeftCorner.Y);
DrawBounds.LowerRightCorner.X = in->getAttributeAsFloat("DrawBoundsX2", DrawBounds.LowerRightCorner.X);
DrawBounds.LowerRightCorner.Y = in->getAttributeAsFloat("DrawBoundsY2", DrawBounds.LowerRightCorner.Y);
setDrawBounds(DrawBounds);
setDrawBackground(in->getAttributeAsBool("DrawBackground", DrawBackground));
}
} // end namespace gui
} // end namespace irr

View File

@ -76,12 +76,6 @@ namespace gui
return DrawBackground;
}
//! Writes attributes of the element.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_;
//! Reads attributes of the element
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_;
protected:
void checkBounds(core::rect<s32>& rect)
{

View File

@ -149,28 +149,6 @@ void CGUIInOutFader::fadeOut(u32 time)
setColor(Color[0],Color[1]);
}
//! Writes attributes of the element.
void CGUIInOutFader::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
{
IGUIInOutFader::serializeAttributes(out,options);
out->addColor ("FullColor", FullColor);
out->addColor ("TransColor", TransColor);
}
//! Reads attributes of the element
void CGUIInOutFader::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{
IGUIInOutFader::deserializeAttributes(in,options);
FullColor = in->getAttributeAsColor("FullColor");
TransColor = in->getAttributeAsColor("TransColor");
}
} // end namespace gui
} // end namespace irr

View File

@ -42,12 +42,6 @@ namespace gui
//! Returns if the fade in or out process is done.
virtual bool isReady() const _IRR_OVERRIDE_;
//! Writes attributes of the element.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_;
//! Reads attributes of the element
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_;
private:
enum EFadeAction

View File

@ -685,86 +685,6 @@ bool CGUIListBox::getSerializationLabels(EGUI_LISTBOX_COLOR colorType, core::str
}
//! Writes attributes of the element.
void CGUIListBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
{
IGUIListBox::serializeAttributes(out,options);
// todo: out->addString ("IconBank", IconBank->getName?);
out->addBool ("DrawBack", DrawBack);
out->addBool ("MoveOverSelect", MoveOverSelect);
out->addBool ("AutoScroll", AutoScroll);
out->addInt("ItemCount", Items.size());
for (u32 i=0;i<Items.size(); ++i)
{
core::stringc label("text");
label += i;
out->addString(label.c_str(), Items[i].Text.c_str() );
for ( s32 c=0; c < (s32)EGUI_LBC_COUNT; ++c )
{
core::stringc useColorLabel, colorLabel;
if ( !getSerializationLabels((EGUI_LISTBOX_COLOR)c, useColorLabel, colorLabel) )
return;
label = useColorLabel; label += i;
if ( Items[i].OverrideColors[c].Use )
{
out->addBool(label.c_str(), true );
label = colorLabel; label += i;
out->addColor(label.c_str(), Items[i].OverrideColors[c].Color);
}
else
{
out->addBool(label.c_str(), false );
}
}
}
out->addInt("Selected", Selected);
}
//! Reads attributes of the element
void CGUIListBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{
clear();
DrawBack = in->getAttributeAsBool("DrawBack", DrawBack);
MoveOverSelect = in->getAttributeAsBool("MoveOverSelect", MoveOverSelect);
AutoScroll = in->getAttributeAsBool("AutoScroll", AutoScroll);
IGUIListBox::deserializeAttributes(in,options);
const s32 count = in->getAttributeAsInt("ItemCount");
for (s32 i=0; i<count; ++i)
{
core::stringc label("text");
ListItem item;
label += i;
item.Text = in->getAttributeAsStringW(label.c_str());
addItem(item.Text.c_str(), item.Icon);
for ( u32 c=0; c < EGUI_LBC_COUNT; ++c )
{
core::stringc useColorLabel, colorLabel;
if ( !getSerializationLabels((EGUI_LISTBOX_COLOR)c, useColorLabel, colorLabel) )
return;
label = useColorLabel; label += i;
Items[i].OverrideColors[c].Use = in->getAttributeAsBool(label.c_str());
if ( Items[i].OverrideColors[c].Use )
{
label = colorLabel; label += i;
Items[i].OverrideColors[c].Color = in->getAttributeAsColor(label.c_str());
}
}
}
Selected = in->getAttributeAsInt("Selected", Selected);
recalculateScrollPos();
}
void CGUIListBox::recalculateItemWidth(s32 icon)
{
if (IconBank && icon > -1 &&

View File

@ -88,12 +88,6 @@ namespace gui
//! Update the position and size of the listbox, and update the scrollbar
virtual void updateAbsolutePosition() _IRR_OVERRIDE_;
//! Writes attributes of the element.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_;
//! Reads attributes of the element
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_;
//! set all item colors at given index to color
virtual void setItemOverrideColor(u32 index, video::SColor color) _IRR_OVERRIDE_;

View File

@ -413,49 +413,6 @@ bool CGUIMessageBox::OnEvent(const SEvent& event)
return CGUIWindow::OnEvent(event);
}
//! Writes attributes of the element.
void CGUIMessageBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
{
CGUIWindow::serializeAttributes(out,options);
out->addBool ("OkayButton", (Flags & EMBF_OK) != 0 );
out->addBool ("CancelButton", (Flags & EMBF_CANCEL) != 0 );
out->addBool ("YesButton", (Flags & EMBF_YES) != 0 );
out->addBool ("NoButton", (Flags & EMBF_NO) != 0 );
out->addTexture ("Texture", IconTexture);
out->addString ("MessageText", MessageText.c_str());
}
//! Reads attributes of the element
void CGUIMessageBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{
Flags = 0;
Flags = in->getAttributeAsBool("OkayButton") ? EMBF_OK : 0;
Flags |= in->getAttributeAsBool("CancelButton")? EMBF_CANCEL : 0;
Flags |= in->getAttributeAsBool("YesButton") ? EMBF_YES : 0;
Flags |= in->getAttributeAsBool("NoButton") ? EMBF_NO : 0;
if ( IconTexture )
{
IconTexture->drop();
IconTexture = NULL;
}
IconTexture = in->getAttributeAsTexture("Texture");
if ( IconTexture )
IconTexture->grab();
MessageText = in->getAttributeAsStringW("MessageText").c_str();
CGUIWindow::deserializeAttributes(in,options);
refreshControls();
}
} // end namespace gui
} // end namespace irr

View File

@ -32,12 +32,6 @@ namespace gui
//! called if an event happened.
virtual bool OnEvent(const SEvent& event) _IRR_OVERRIDE_;
//! Writes attributes of the element.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_;
//! Reads attributes of the element
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_;
private:
void refreshControls();

View File

@ -230,24 +230,6 @@ void CGUIModalScreen::updateAbsolutePosition()
IGUIElement::updateAbsolutePosition();
}
//! Writes attributes of the element.
void CGUIModalScreen::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
{
IGUIElement::serializeAttributes(out,options);
out->addInt("BlinkMode", BlinkMode );
}
//! Reads attributes of the element
void CGUIModalScreen::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{
IGUIElement::deserializeAttributes(in, options);
BlinkMode = in->getAttributeAsInt("BlinkMode", BlinkMode);
}
} // end namespace gui
} // end namespace irr

View File

@ -46,12 +46,6 @@ namespace gui
//! Modals are infinite so every point is inside
virtual bool isPointInside(const core::position2d<s32>& point) const _IRR_OVERRIDE_;
//! Writes attributes of the element.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_;
//! Reads attributes of the element
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_;
//! Set when to blink.
//! Bitset of following values (can be combined)
//! 0 = never

View File

@ -532,39 +532,6 @@ void CGUIScrollBar::refreshControls()
}
}
//! Writes attributes of the element.
void CGUIScrollBar::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
{
IGUIScrollBar::serializeAttributes(out,options);
out->addBool("Horizontal", Horizontal);
out->addInt ("Value", Pos);
out->addInt ("Min", Min);
out->addInt ("Max", Max);
out->addInt ("SmallStep", SmallStep);
out->addInt ("LargeStep", LargeStep);
// CurrentIconColor - not serialized as continuously updated
}
//! Reads attributes of the element
void CGUIScrollBar::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{
IGUIScrollBar::deserializeAttributes(in,options);
Horizontal = in->getAttributeAsBool("Horizontal", Horizontal);
setMin(in->getAttributeAsInt("Min", Min));
setMax(in->getAttributeAsInt("Max", Max));
setPos(in->getAttributeAsInt("Value", Pos));
setSmallStep(in->getAttributeAsInt("SmallStep", SmallStep));
setLargeStep(in->getAttributeAsInt("LargeStep", LargeStep));
// CurrentIconColor - not serialized as continuously updated
refreshControls();
}
} // end namespace gui
} // end namespace irr

View File

@ -70,12 +70,6 @@ namespace gui
//! updates the rectangle
virtual void updateAbsolutePosition() _IRR_OVERRIDE_;
//! Writes attributes of the element.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_;
//! Reads attributes of the element
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_;
private:
void refreshControls();

View File

@ -971,43 +971,6 @@ void CGUISkin::draw2DRectangle(IGUIElement* element,
Driver->draw2DRectangle(color, pos, clip);
}
//! Writes attributes of the skin
void CGUISkin::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const
{
u32 i;
for (i=0; i<EGDC_COUNT; ++i)
out->addColor(GUISkinColorNames[i], Colors[i]);
for (i=0; i<EGDS_COUNT; ++i)
out->addInt(GUISkinSizeNames[i], Sizes[i]);
for (i=0; i<EGDT_COUNT; ++i)
out->addString(GUISkinTextNames[i], Texts[i].c_str());
for (i=0; i<EGDI_COUNT; ++i)
out->addInt(GUISkinIconNames[i], Icons[i]);
}
//! Reads attributes of the skikn
void CGUISkin::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
{
u32 i;
for (i=0; i<EGDC_COUNT; ++i)
Colors[i] = in->getAttributeAsColor(GUISkinColorNames[i], Colors[i]);
for (i=0; i<EGDS_COUNT; ++i)
Sizes[i] = in->getAttributeAsInt(GUISkinSizeNames[i], Sizes[i]);
for (i=0; i<EGDT_COUNT; ++i)
Texts[i] = in->getAttributeAsStringW(GUISkinTextNames[i], Texts[i]);
for (i=0; i<EGDI_COUNT; ++i)
Icons[i] = in->getAttributeAsInt(GUISkinIconNames[i], Icons[i]);
}
} // end namespace gui
} // end namespace irr

View File

@ -216,12 +216,6 @@ namespace gui
//! get the type of this skin
virtual EGUI_SKIN_TYPE getType() const _IRR_OVERRIDE_;
//! Writes attributes of the skin
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_;
//! Reads attributes of the skin
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_;
private:
video::SColor Colors[EGDC_COUNT];

View File

@ -316,29 +316,6 @@ const wchar_t* CGUISpinBox::getText() const
}
//! Writes attributes of the element.
void CGUISpinBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const
{
IGUIElement::serializeAttributes(out, options);
out->addFloat("Min", getMin());
out->addFloat("Max", getMax());
out->addFloat("Step", getStepSize());
out->addInt("DecimalPlaces", DecimalPlaces);
out->addInt("ValidateOn", (s32)ValidateOn);
}
//! Reads attributes of the element
void CGUISpinBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
{
IGUIElement::deserializeAttributes(in, options);
setRange(in->getAttributeAsFloat("Min", RangeMin), in->getAttributeAsFloat("Max", RangeMax));
setStepSize(in->getAttributeAsFloat("Step", StepSize));
setDecimalPlaces(in->getAttributeAsInt("DecimalPlaces", DecimalPlaces));
setValidateOn((u32)in->getAttributeAsInt("ValidateOn", (s32)ValidateOn) );
}
} // end namespace gui
} // end namespace irr

View File

@ -83,12 +83,6 @@ namespace gui
//! Gets when the spinbox has to validate entered text.
virtual u32 getValidateOn() const _IRR_OVERRIDE_;
//! Writes attributes of the element.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_;
//! Reads attributes of the element
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_;
protected:
virtual void verifyValueRange();
void refreshSprites();

View File

@ -590,51 +590,6 @@ s32 CGUIStaticText::getTextWidth() const
}
//! Writes attributes of the element.
//! Implement this to expose the attributes of your element for
//! scripting languages, editors, debuggers or xml serialization purposes.
void CGUIStaticText::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
{
IGUIStaticText::serializeAttributes(out,options);
out->addBool ("Border", Border);
out->addBool ("OverrideColorEnabled",OverrideColorEnabled);
out->addBool ("OverrideBGColorEnabled",OverrideBGColorEnabled);
out->addBool ("WordWrap", WordWrap);
out->addBool ("Background", Background);
out->addBool ("RightToLeft", RightToLeft);
out->addBool ("RestrainTextInside", RestrainTextInside);
out->addColor ("OverrideColor", OverrideColor);
out->addColor ("BGColor", BGColor);
out->addEnum ("HTextAlign", HAlign, GUIAlignmentNames);
out->addEnum ("VTextAlign", VAlign, GUIAlignmentNames);
// out->addFont ("OverrideFont", OverrideFont);
}
//! Reads attributes of the element
void CGUIStaticText::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{
IGUIStaticText::deserializeAttributes(in,options);
Border = in->getAttributeAsBool("Border", Border);
enableOverrideColor(in->getAttributeAsBool("OverrideColorEnabled", OverrideColorEnabled));
OverrideBGColorEnabled = in->getAttributeAsBool("OverrideBGColorEnabled", OverrideBGColorEnabled);
setWordWrap(in->getAttributeAsBool("WordWrap", WordWrap));
Background = in->getAttributeAsBool("Background", Background);
RightToLeft = in->getAttributeAsBool("RightToLeft", RightToLeft);
RestrainTextInside = in->getAttributeAsBool("RestrainTextInside", RestrainTextInside);
OverrideColor = in->getAttributeAsColor("OverrideColor", OverrideColor);
BGColor = in->getAttributeAsColor("BGColor", BGColor);
setTextAlignment( (EGUI_ALIGNMENT) in->getAttributeAsEnumeration("HTextAlign", GUIAlignmentNames, (s32)HAlign),
(EGUI_ALIGNMENT) in->getAttributeAsEnumeration("VTextAlign", GUIAlignmentNames, (s32)VAlign));
// OverrideFont = in->getAttributeAsFont("OverrideFont");
}
} // end namespace gui
} // end namespace irr

View File

@ -112,12 +112,6 @@ namespace gui
//! Checks if the text should be interpreted as right-to-left text
virtual bool isRightToLeft() const _IRR_OVERRIDE_;
//! Writes attributes of the element.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_;
//! Reads attributes of the element
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_;
private:
//! Breaks the single text line.

View File

@ -98,45 +98,6 @@ video::SColor CGUITab::getBackgroundColor() const
}
//! Writes attributes of the element.
void CGUITab::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
{
IGUITab::serializeAttributes(out,options);
IGUITabControl* parentTabControl = Parent && Parent->getType() == EGUIET_TAB_CONTROL ? static_cast<IGUITabControl*>(Parent) : 0;
if ( parentTabControl )
out->addInt ("TabNumber", parentTabControl->getTabIndex(this)); // order of children and tabs can be different, so we save tab-number
out->addBool ("DrawBackground", DrawBackground);
out->addColor ("BackColor", BackColor);
out->addBool ("OverrideTextColorEnabled", OverrideTextColorEnabled);
out->addColor ("TextColor", TextColor);
}
//! Reads attributes of the element
void CGUITab::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{
IGUITab::deserializeAttributes(in,options);
setDrawBackground(in->getAttributeAsBool("DrawBackground", DrawBackground));
setBackgroundColor(in->getAttributeAsColor("BackColor", BackColor));
bool overrideColor = in->getAttributeAsBool("OverrideTextColorEnabled", OverrideTextColorEnabled);
setTextColor(in->getAttributeAsColor("TextColor", TextColor));
OverrideTextColorEnabled = overrideColor; // because setTextColor does set OverrideTextColorEnabled always to true
IGUITabControl* parentTabControl = Parent && Parent->getType() == EGUIET_TAB_CONTROL ? static_cast<IGUITabControl*>(Parent) : 0;
if (parentTabControl)
{
s32 idx = in->getAttributeAsInt("TabNumber", -1);
if ( idx >= 0 )
parentTabControl->insertTab(idx, this, true);
else
parentTabControl->addTab(this);
}
}
// ------------------------------------------------------------------
// Tabcontrol
// ------------------------------------------------------------------
@ -1020,38 +981,6 @@ void CGUITabControl::updateAbsolutePosition()
}
//! Writes attributes of the element.
void CGUITabControl::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
{
IGUITabControl::serializeAttributes(out,options);
out->addInt ("ActiveTab", ActiveTabIndex);
out->addBool("Border", Border);
out->addBool("FillBackground", FillBackground);
out->addInt ("TabHeight", TabHeight);
out->addInt ("TabMaxWidth", TabMaxWidth);
out->addEnum("TabVerticalAlignment", s32(VerticalAlignment), GUIAlignmentNames);
}
//! Reads attributes of the element
void CGUITabControl::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{
Border = in->getAttributeAsBool("Border");
FillBackground = in->getAttributeAsBool("FillBackground");
ActiveTabIndex = -1;
setTabHeight(in->getAttributeAsInt("TabHeight"));
TabMaxWidth = in->getAttributeAsInt("TabMaxWidth");
IGUITabControl::deserializeAttributes(in,options);
ActiveTabIndex = in->getAttributeAsInt("ActiveTab", -1); // not setActiveTab as tabs are loaded later
setTabVerticalAlignment( static_cast<EGUI_ALIGNMENT>(in->getAttributeAsEnumeration("TabVerticalAlignment" , GUIAlignmentNames)) );
}
} // end namespace irr
} // end namespace gui

View File

@ -49,12 +49,6 @@ namespace gui
virtual video::SColor getTextColor() const _IRR_OVERRIDE_;
//! Writes attributes of the element.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_;
//! Reads attributes of the element
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_;
private:
video::SColor BackColor;
@ -127,14 +121,9 @@ namespace gui
//! Removes a child.
virtual void removeChild(IGUIElement* child) _IRR_OVERRIDE_;
//! Writes attributes of the element.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_;
//! Set the height of the tabs
virtual void setTabHeight( s32 height ) _IRR_OVERRIDE_;
//! Reads attributes of the element
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_;
//! Get the height of the tabs
virtual s32 getTabHeight() const _IRR_OVERRIDE_;

View File

@ -1135,160 +1135,6 @@ bool CGUITable::isDrawBackgroundEnabled() const
return DrawBack;
}
//! Writes attributes of the element.
void CGUITable::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const
{
IGUITable::serializeAttributes(out, options);
out->addInt("ColumnCount", Columns.size());
u32 i;
for (i=0;i<Columns.size(); ++i)
{
core::stringc label;
label = "Column"; label += i; label += "name";
out->addString(label.c_str(), Columns[i].Name.c_str() );
label = "Column"; label += i; label += "width";
out->addInt(label.c_str(), Columns[i].Width );
label = "Column"; label += i; label += "OrderingMode";
out->addEnum(label.c_str(), Columns[i].OrderingMode, GUIColumnOrderingNames);
}
out->addInt("RowCount", Rows.size());
for (i=0;i<Rows.size(); ++i)
{
core::stringc label;
// Height currently not used and could be recalculated anyway
//label = "Row"; label += i; label += "height";
//out->addInt(label.c_str(), Rows[i].Height );
//label = "Row"; label += i; label += "ItemCount";
//out->addInt(label.c_str(), Rows[i].Items.size());
u32 c;
for ( c=0; c < Rows[i].Items.size(); ++c )
{
label = "Row"; label += i; label += "cell"; label += c; label += "text";
out->addString(label.c_str(), Rows[i].Items[c].Text.c_str() );
// core::stringw BrokenText; // can be recalculated
label = "Row"; label += i; label += "cell"; label += c; label += "color";
out->addColor(label.c_str(), Rows[i].Items[c].Color );
label = "Row"; label += i; label += "cell"; label += c; label += "IsOverrideColor";
out->addColor(label.c_str(), Rows[i].Items[c].IsOverrideColor );
// void *data; // can't be serialized
}
}
// s32 ItemHeight; // can be calculated
// TotalItemHeight // calculated
// TotalItemWidth // calculated
// gui::IGUIFont* ActiveFont; // TODO: we don't have a sane font-serialization so far
// gui::IGUIScrollBar* VerticalScrollBar; // not serialized
// gui::IGUIScrollBar* HorizontalScrollBar; // not serialized
out->addBool ("Clip", Clip);
out->addBool ("DrawBack", DrawBack);
out->addBool ("MoveOverSelect", MoveOverSelect);
// s32 CurrentResizedColumn; // runtime info - depends on user action
out->addBool ("ResizableColumns", ResizableColumns);
// s32 Selected; // runtime info - depends on user action
out->addInt("CellWidthPadding", CellWidthPadding );
out->addInt("CellHeightPadding", CellHeightPadding );
// s32 ActiveTab; // runtime info - depends on user action
// bool Selecting; // runtime info - depends on user action
out->addEnum("CurrentOrdering", CurrentOrdering, GUIOrderingModeNames);
out->addInt("DrawFlags", DrawFlags);
}
//! Reads attributes of the element
void CGUITable::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
{
IGUITable::deserializeAttributes(in, options);
Columns.clear();
u32 columnCount = in->getAttributeAsInt("ColumnCount");
u32 i;
for (i=0;i<columnCount; ++i)
{
core::stringc label;
Column column;
label = "Column"; label += i; label += "name";
column.Name = core::stringw(in->getAttributeAsString(label.c_str()).c_str());
label = "Column"; label += i; label += "width";
column.Width = in->getAttributeAsInt(label.c_str());
label = "Column"; label += i; label += "OrderingMode";
column.OrderingMode = EGCO_NONE;
s32 co = in->getAttributeAsEnumeration(label.c_str(), GUIColumnOrderingNames);
if (co > 0)
column.OrderingMode = EGUI_COLUMN_ORDERING(co);
Columns.push_back(column);
}
Rows.clear();
u32 rowCount = in->getAttributeAsInt("RowCount");
for (i=0; i<rowCount; ++i)
{
core::stringc label;
Row row;
// Height currently not used and could be recalculated anyway
//label = "Row"; label += i; label += "height";
//row.Height = in->getAttributeAsInt(label.c_str() );
Rows.push_back(row);
//label = "Row"; label += i; label += "ItemCount";
//u32 itemCount = in->getAttributeAsInt(label.c_str());
u32 c;
for ( c=0; c < columnCount; ++c )
{
Cell cell;
label = "Row"; label += i; label += "cell"; label += c; label += "text";
cell.Text = core::stringw(in->getAttributeAsString(label.c_str()).c_str());
breakText( cell.Text, cell.BrokenText, Columns[c].Width );
label = "Row"; label += i; label += "cell"; label += c; label += "color";
cell.Color = in->getAttributeAsColor(label.c_str());
label = "Row"; label += i; label += "cell"; label += c; label += "IsOverrideColor";
cell.IsOverrideColor = in->getAttributeAsBool(label.c_str());
cell.Data = NULL;
Rows[Rows.size()-1].Items.push_back(cell);
}
}
ItemHeight = 0; // calculated
TotalItemHeight = 0; // calculated
TotalItemWidth = 0; // calculated
Clip = in->getAttributeAsBool("Clip", Clip);
DrawBack = in->getAttributeAsBool("DrawBack", DrawBack);
MoveOverSelect = in->getAttributeAsBool("MoveOverSelect", MoveOverSelect);
CurrentResizedColumn = -1;
ResizeStart = 0;
ResizableColumns = in->getAttributeAsBool("ResizableColumns", ResizableColumns);
Selected = -1;
CellWidthPadding = in->getAttributeAsInt("CellWidthPadding", CellWidthPadding);
CellHeightPadding = in->getAttributeAsInt("CellHeightPadding", CellHeightPadding);
ActiveTab = -1;
Selecting = false;
CurrentOrdering = (EGUI_ORDERING_MODE) in->getAttributeAsEnumeration("CurrentOrdering", GUIOrderingModeNames, (s32)CurrentOrdering);
DrawFlags = in->getAttributeAsInt("DrawFlags", DrawFlags);
refreshControls();
}
} // end namespace gui
} // end namespace irr

View File

@ -168,16 +168,6 @@ namespace gui
/** \return true if background drawing is enabled, false otherwise */
virtual bool isDrawBackgroundEnabled() const _IRR_OVERRIDE_;
//! Writes attributes of the object.
//! Implement this to expose the attributes of your scene node animator for
//! scripting languages, editors, debuggers or xml serialization purposes.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_;
//! Reads attributes of the object.
//! Implement this to set the attributes of your scene node animator for
//! scripting languages, editors, debuggers or xml deserialization purposes.
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_;
protected:
void refreshControls();
void checkScrollbars();

View File

@ -356,47 +356,6 @@ core::rect<s32> CGUIWindow::getClientRect() const
return ClientRect;
}
//! Writes attributes of the element.
void CGUIWindow::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
{
IGUIWindow::serializeAttributes(out,options);
out->addBool("IsDraggable", IsDraggable);
out->addBool("DrawBackground", DrawBackground);
out->addBool("DrawTitlebar", DrawTitlebar);
// Currently we can't just serialize attributes of sub-elements.
// To do this we either
// a) allow further serialization after attribute serialiation (second function, callback or event)
// b) add an IGUIElement attribute
// c) extend the attribute system to allow attributes to have sub-attributes
// We just serialize the most important info for now until we can do one of the above solutions.
out->addBool("IsCloseVisible", CloseButton->isVisible());
out->addBool("IsMinVisible", MinButton->isVisible());
out->addBool("IsRestoreVisible", RestoreButton->isVisible());
}
//! Reads attributes of the element
void CGUIWindow::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{
IGUIWindow::deserializeAttributes(in,options);
Dragging = false;
IsActive = false;
IsDraggable = in->getAttributeAsBool("IsDraggable");
DrawBackground = in->getAttributeAsBool("DrawBackground");
DrawTitlebar = in->getAttributeAsBool("DrawTitlebar");
CloseButton->setVisible(in->getAttributeAsBool("IsCloseVisible"));
MinButton->setVisible(in->getAttributeAsBool("IsMinVisible"));
RestoreButton->setVisible(in->getAttributeAsBool("IsRestoreVisible"));
updateClientRect();
}
} // end namespace gui
} // end namespace irr

View File

@ -66,12 +66,6 @@ namespace gui
//! Returns the rectangle of the drawable area (without border and without titlebar)
virtual core::rect<s32> getClientRect() const _IRR_OVERRIDE_;
//! Writes attributes of the element.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_;
//! Reads attributes of the element
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_;
protected:
void updateClientRect();

View File

@ -170,8 +170,8 @@ void CMeshSceneNode::render()
if (DebugDataVisible & scene::EDS_NORMALS)
{
// draw normals
const f32 debugNormalLength = SceneManager->getParameters()->getAttributeAsFloat(DEBUG_NORMAL_LENGTH);
const video::SColor debugNormalColor = SceneManager->getParameters()->getAttributeAsColor(DEBUG_NORMAL_COLOR);
const f32 debugNormalLength = 1.f;
const video::SColor debugNormalColor = video::SColor(255, 34, 221, 221);
const u32 count = Mesh->getMeshBufferCount();
for (u32 i=0; i != count; ++i)
@ -276,75 +276,6 @@ void CMeshSceneNode::copyMaterials()
}
//! Writes attributes of the scene node.
void CMeshSceneNode::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const
{
IMeshSceneNode::serializeAttributes(out, options);
if (options && (options->Flags&io::EARWF_USE_RELATIVE_PATHS) && options->Filename)
{
const io::path path = SceneManager->getFileSystem()->getRelativeFilename(
SceneManager->getFileSystem()->getAbsolutePath(SceneManager->getMeshCache()->getMeshName(Mesh).getPath()),
options->Filename);
out->addString("Mesh", path.c_str());
}
else
out->addString("Mesh", SceneManager->getMeshCache()->getMeshName(Mesh).getPath().c_str());
out->addBool("ReadOnlyMaterials", ReadOnlyMaterials);
}
//! Reads attributes of the scene node.
void CMeshSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
{
io::path oldMeshStr = SceneManager->getMeshCache()->getMeshName(Mesh);
io::path newMeshStr = in->getAttributeAsString("Mesh");
ReadOnlyMaterials = in->getAttributeAsBool("ReadOnlyMaterials");
if (newMeshStr != "" && oldMeshStr != newMeshStr)
{
IMesh* newMesh = 0;
IAnimatedMesh* newAnimatedMesh = SceneManager->getMesh(newMeshStr.c_str());
if (newAnimatedMesh)
newMesh = newAnimatedMesh->getMesh(0);
if (newMesh)
setMesh(newMesh);
}
// optional attribute to assign the hint to the whole mesh
if (in->existsAttribute("HardwareMappingHint") &&
in->existsAttribute("HardwareMappingBufferType"))
{
scene::E_HARDWARE_MAPPING mapping = scene::EHM_NEVER;
scene::E_BUFFER_TYPE bufferType = scene::EBT_NONE;
core::stringc smapping = in->getAttributeAsString("HardwareMappingHint");
if (smapping.equals_ignore_case("static"))
mapping = scene::EHM_STATIC;
else if (smapping.equals_ignore_case("dynamic"))
mapping = scene::EHM_DYNAMIC;
else if (smapping.equals_ignore_case("stream"))
mapping = scene::EHM_STREAM;
core::stringc sbufferType = in->getAttributeAsString("HardwareMappingBufferType");
if (sbufferType.equals_ignore_case("vertex"))
bufferType = scene::EBT_VERTEX;
else if (sbufferType.equals_ignore_case("index"))
bufferType = scene::EBT_INDEX;
else if (sbufferType.equals_ignore_case("vertexindex"))
bufferType = scene::EBT_VERTEX_AND_INDEX;
IMesh* mesh = getMesh();
if (mesh)
mesh->setHardwareMappingHint(mapping, bufferType);
}
IMeshSceneNode::deserializeAttributes(in, options);
}
//! Sets if the scene node should not copy the materials of the mesh but use them in a read only style.
/* In this way it is possible to change the materials a mesh causing all mesh scene nodes
referencing this mesh to change too. */

View File

@ -45,12 +45,6 @@ namespace scene
//! returns amount of materials used by this scene node.
virtual u32 getMaterialCount() const _IRR_OVERRIDE_;
//! Writes attributes of the scene node.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_;
//! Reads attributes of the scene node.
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_;
//! Returns type of the scene node
virtual ESCENE_NODE_TYPE getType() const _IRR_OVERRIDE_ { return ESNT_MESH; }

View File

@ -14,7 +14,7 @@
#include "IAnimatedMeshSceneNode.h"
#include "CMeshManipulator.h"
#include "CColorConverter.h"
#include "IAttributeExchangingObject.h"
#include "IReferenceCounted.h"
#include "IRenderTarget.h"
@ -2000,193 +2000,6 @@ void CNullDriver::swapMaterialRenderers(u32 idx1, u32 idx2, bool swapNames)
}
}
//! Creates material attributes list from a material, usable for serialization and more.
io::IAttributes* CNullDriver::createAttributesFromMaterial(const video::SMaterial& material,
io::SAttributeReadWriteOptions* options)
{
io::CAttributes* attr = new io::CAttributes(this);
attr->addEnum("Type", material.MaterialType, sBuiltInMaterialTypeNames);
attr->addColor("Ambient", material.AmbientColor);
attr->addColor("Diffuse", material.DiffuseColor);
attr->addColor("Emissive", material.EmissiveColor);
attr->addColor("Specular", material.SpecularColor);
attr->addFloat("Shininess", material.Shininess);
attr->addFloat("Param1", material.MaterialTypeParam);
attr->addFloat("Param2", material.MaterialTypeParam2);
attr->addFloat("Thickness", material.Thickness);
core::stringc prefix="Texture";
u32 i;
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
{
video::ITexture* texture = material.getTexture(i);
if (options && (options->Flags&io::EARWF_USE_RELATIVE_PATHS) && options->Filename && texture)
{
io::path path = FileSystem->getRelativeFilename(
FileSystem->getAbsolutePath(material.getTexture(i)->getName()), options->Filename);
attr->addTexture((prefix+core::stringc(i+1)).c_str(), material.getTexture(i), path);
}
else
{
attr->addTexture((prefix+core::stringc(i+1)).c_str(), texture);
}
}
attr->addBool("Wireframe", material.Wireframe);
attr->addBool("PointCloud", material.PointCloud);
attr->addBool("GouraudShading", material.GouraudShading);
attr->addBool("Lighting", material.Lighting);
attr->addEnum("ZWriteEnable", (irr::s32)material.ZWriteEnable, video::ZWriteNames);
attr->addInt("ZBuffer", material.ZBuffer);
attr->addBool("BackfaceCulling", material.BackfaceCulling);
attr->addBool("FrontfaceCulling", material.FrontfaceCulling);
attr->addBool("FogEnable", material.FogEnable);
attr->addBool("NormalizeNormals", material.NormalizeNormals);
attr->addBool("UseMipMaps", material.UseMipMaps);
attr->addInt("AntiAliasing", material.AntiAliasing);
attr->addInt("ColorMask", material.ColorMask);
attr->addInt("ColorMaterial", material.ColorMaterial);
attr->addInt("BlendOperation", material.BlendOperation);
attr->addFloat("BlendFactor", material.BlendFactor);
attr->addInt("PolygonOffsetFactor", material.PolygonOffsetFactor);
attr->addEnum("PolygonOffsetDirection", material.PolygonOffsetDirection, video::PolygonOffsetDirectionNames);
attr->addFloat("PolygonOffsetDepthBias", material.PolygonOffsetDepthBias);
attr->addFloat("PolygonOffsetSlopeScale", material.PolygonOffsetSlopeScale);
// TODO: Would be nice to have a flag that only serializes rest of texture data when a texture pointer exists.
prefix = "BilinearFilter";
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
attr->addBool((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].BilinearFilter);
prefix = "TrilinearFilter";
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
attr->addBool((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].TrilinearFilter);
prefix = "AnisotropicFilter";
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
attr->addInt((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].AnisotropicFilter);
prefix="TextureWrapU";
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
attr->addEnum((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].TextureWrapU, aTextureClampNames);
prefix="TextureWrapV";
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
attr->addEnum((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].TextureWrapV, aTextureClampNames);
prefix="TextureWrapW";
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
attr->addEnum((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].TextureWrapW, aTextureClampNames);
prefix="LODBias";
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
attr->addInt((prefix+core::stringc(i+1)).c_str(), material.TextureLayer[i].LODBias);
return attr;
}
//! Fills an SMaterial structure from attributes.
void CNullDriver::fillMaterialStructureFromAttributes(video::SMaterial& outMaterial, io::IAttributes* attr)
{
outMaterial.MaterialType = video::EMT_SOLID;
core::stringc name = attr->getAttributeAsString("Type");
u32 i;
for ( i=0; i < MaterialRenderers.size(); ++i)
if ( name == MaterialRenderers[i].Name )
{
outMaterial.MaterialType = (video::E_MATERIAL_TYPE)i;
break;
}
outMaterial.AmbientColor = attr->getAttributeAsColor("Ambient", outMaterial.AmbientColor);
outMaterial.DiffuseColor = attr->getAttributeAsColor("Diffuse", outMaterial.DiffuseColor);
outMaterial.EmissiveColor = attr->getAttributeAsColor("Emissive", outMaterial.EmissiveColor);
outMaterial.SpecularColor = attr->getAttributeAsColor("Specular", outMaterial.SpecularColor);
outMaterial.Shininess = attr->getAttributeAsFloat("Shininess", outMaterial.Shininess);
outMaterial.MaterialTypeParam = attr->getAttributeAsFloat("Param1", outMaterial.MaterialTypeParam);
outMaterial.MaterialTypeParam2 = attr->getAttributeAsFloat("Param2", outMaterial.MaterialTypeParam2);
outMaterial.Thickness = attr->getAttributeAsFloat("Thickness", outMaterial.Thickness);
core::stringc prefix="Texture";
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
outMaterial.setTexture(i, attr->getAttributeAsTexture((prefix+core::stringc(i+1)).c_str()));
outMaterial.Wireframe = attr->getAttributeAsBool("Wireframe", outMaterial.Wireframe);
outMaterial.PointCloud = attr->getAttributeAsBool("PointCloud", outMaterial.PointCloud);
outMaterial.GouraudShading = attr->getAttributeAsBool("GouraudShading", outMaterial.GouraudShading);
outMaterial.Lighting = attr->getAttributeAsBool("Lighting", outMaterial.Lighting);
io::E_ATTRIBUTE_TYPE attType = attr->getAttributeType("ZWriteEnable");
if (attType == io::EAT_BOOL ) // Before Irrlicht 1.9
outMaterial.ZWriteEnable = attr->getAttributeAsBool("ZWriteEnable", outMaterial.ZWriteEnable != video::EZW_OFF ) ? video::EZW_AUTO : video::EZW_OFF;
else if (attType == io::EAT_ENUM )
outMaterial.ZWriteEnable = (video::E_ZWRITE)attr->getAttributeAsEnumeration("ZWriteEnable", video::ZWriteNames, outMaterial.ZWriteEnable);
outMaterial.ZBuffer = (u8)attr->getAttributeAsInt("ZBuffer", outMaterial.ZBuffer);
outMaterial.BackfaceCulling = attr->getAttributeAsBool("BackfaceCulling", outMaterial.BackfaceCulling);
outMaterial.FrontfaceCulling = attr->getAttributeAsBool("FrontfaceCulling", outMaterial.FrontfaceCulling);
outMaterial.FogEnable = attr->getAttributeAsBool("FogEnable", outMaterial.FogEnable);
outMaterial.NormalizeNormals = attr->getAttributeAsBool("NormalizeNormals", outMaterial.NormalizeNormals);
outMaterial.UseMipMaps = attr->getAttributeAsBool("UseMipMaps", outMaterial.UseMipMaps);
outMaterial.AntiAliasing = attr->getAttributeAsInt("AntiAliasing", outMaterial.AntiAliasing);
outMaterial.ColorMask = attr->getAttributeAsInt("ColorMask", outMaterial.ColorMask);
outMaterial.ColorMaterial = attr->getAttributeAsInt("ColorMaterial", outMaterial.ColorMaterial);
outMaterial.BlendOperation = (video::E_BLEND_OPERATION)attr->getAttributeAsInt("BlendOperation", outMaterial.BlendOperation);
outMaterial.BlendFactor = attr->getAttributeAsFloat("BlendFactor", outMaterial.BlendFactor);
outMaterial.PolygonOffsetFactor = attr->getAttributeAsInt("PolygonOffsetFactor", outMaterial.PolygonOffsetFactor);
outMaterial.PolygonOffsetDirection = (video::E_POLYGON_OFFSET)attr->getAttributeAsEnumeration("PolygonOffsetDirection", video::PolygonOffsetDirectionNames, outMaterial.PolygonOffsetDirection);
outMaterial.PolygonOffsetDepthBias = attr->getAttributeAsFloat("PolygonOffsetDepthBias", outMaterial.PolygonOffsetDepthBias);
outMaterial.PolygonOffsetSlopeScale = attr->getAttributeAsFloat("PolygonOffsetSlopeScale", outMaterial.PolygonOffsetSlopeScale);
prefix = "BilinearFilter";
if (attr->existsAttribute(prefix.c_str())) // legacy
outMaterial.setFlag(EMF_BILINEAR_FILTER, attr->getAttributeAsBool(prefix.c_str()));
else
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
outMaterial.TextureLayer[i].BilinearFilter = attr->getAttributeAsBool((prefix+core::stringc(i+1)).c_str(), outMaterial.TextureLayer[i].BilinearFilter);
prefix = "TrilinearFilter";
if (attr->existsAttribute(prefix.c_str())) // legacy
outMaterial.setFlag(EMF_TRILINEAR_FILTER, attr->getAttributeAsBool(prefix.c_str()));
else
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
outMaterial.TextureLayer[i].TrilinearFilter = attr->getAttributeAsBool((prefix+core::stringc(i+1)).c_str(), outMaterial.TextureLayer[i].TrilinearFilter);
prefix = "AnisotropicFilter";
if (attr->existsAttribute(prefix.c_str())) // legacy
outMaterial.setFlag(EMF_ANISOTROPIC_FILTER, attr->getAttributeAsBool(prefix.c_str()));
else
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
outMaterial.TextureLayer[i].AnisotropicFilter = attr->getAttributeAsInt((prefix+core::stringc(i+1)).c_str(), outMaterial.TextureLayer[i].AnisotropicFilter);
prefix = "TextureWrap";
if (attr->existsAttribute(prefix.c_str())) // legacy
{
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
{
outMaterial.TextureLayer[i].TextureWrapU = (E_TEXTURE_CLAMP)attr->getAttributeAsEnumeration((prefix+core::stringc(i+1)).c_str(), aTextureClampNames);
outMaterial.TextureLayer[i].TextureWrapV = outMaterial.TextureLayer[i].TextureWrapU;
outMaterial.TextureLayer[i].TextureWrapW = outMaterial.TextureLayer[i].TextureWrapW;
}
}
else
{
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
{
outMaterial.TextureLayer[i].TextureWrapU = (E_TEXTURE_CLAMP)attr->getAttributeAsEnumeration((prefix+"U"+core::stringc(i+1)).c_str(), aTextureClampNames, outMaterial.TextureLayer[i].TextureWrapU);
outMaterial.TextureLayer[i].TextureWrapV = (E_TEXTURE_CLAMP)attr->getAttributeAsEnumeration((prefix+"V"+core::stringc(i+1)).c_str(), aTextureClampNames, outMaterial.TextureLayer[i].TextureWrapV);
outMaterial.TextureLayer[i].TextureWrapW = (E_TEXTURE_CLAMP)attr->getAttributeAsEnumeration((prefix+"W"+core::stringc(i+1)).c_str(), aTextureClampNames, outMaterial.TextureLayer[i].TextureWrapW);
}
}
prefix="LODBias";
for (i=0; i<MATERIAL_MAX_TEXTURES; ++i)
outMaterial.TextureLayer[i].LODBias = attr->getAttributeAsInt((prefix+core::stringc(i+1)).c_str(), outMaterial.TextureLayer[i].LODBias);
}
//! Returns driver and operating system specific data about the IVideoDriver.
const SExposedVideoData& CNullDriver::getExposedVideoData()

View File

@ -617,13 +617,6 @@ namespace video
//! Swap the material renderers used for certain id's
virtual void swapMaterialRenderers(u32 idx1, u32 idx2, bool swapNames) _IRR_OVERRIDE_;
//! Creates material attributes list from a material, usable for serialization and more.
virtual io::IAttributes* createAttributesFromMaterial(const video::SMaterial& material,
io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_;
//! Fills an SMaterial structure from attributes.
virtual void fillMaterialStructureFromAttributes(video::SMaterial& outMaterial, io::IAttributes* attributes) _IRR_OVERRIDE_;
//! looks if the image is already loaded
virtual video::ITexture* findTexture(const io::path& filename) _IRR_OVERRIDE_;

View File

@ -8,12 +8,10 @@
#include "IFileSystem.h"
#include "SAnimatedMesh.h"
#include "CMeshCache.h"
#include "ISceneUserDataSerializer.h"
#include "IGUIEnvironment.h"
#include "IMaterialRenderer.h"
#include "IReadFile.h"
#include "IWriteFile.h"
#include "ISceneLoader.h"
#include "EProfileIDs.h"
#include "IProfiler.h"
@ -92,8 +90,6 @@ CSceneManager::CSceneManager(video::IVideoDriver* driver, io::IFileSystem* fs,
// set scene parameters
Parameters = new io::CAttributes();
Parameters->setAttribute(DEBUG_NORMAL_LENGTH, 1.f);
Parameters->setAttribute(DEBUG_NORMAL_COLOR, video::SColor(255, 34, 221, 221));
// create collision manager
CollisionManager = new CSceneCollisionManager(this, Driver);
@ -167,9 +163,6 @@ CSceneManager::~CSceneManager()
for (i=0; i<MeshLoaderList.size(); ++i)
MeshLoaderList[i]->drop();
for (i=0; i<SceneLoaderList.size(); ++i)
SceneLoaderList[i]->drop();
if (ActiveCamera)
ActiveCamera->drop();
ActiveCamera = 0;
@ -700,7 +693,7 @@ void CSceneManager::drawAll()
CameraList.set_used(0);
}
// render skyboxes
{
IRR_PROFILE(CProfileScope psSkyBox(EPID_SM_RENDER_SKYBOXES);)
@ -712,7 +705,7 @@ void CSceneManager::drawAll()
SkyBoxList.set_used(0);
}
// render default objects
{
IRR_PROFILE(CProfileScope psDefault(EPID_SM_RENDER_DEFAULT);)
@ -809,33 +802,6 @@ IMeshLoader* CSceneManager::getMeshLoader(u32 index) const
}
//! Adds an external scene loader.
void CSceneManager::addExternalSceneLoader(ISceneLoader* externalLoader)
{
if (!externalLoader)
return;
externalLoader->grab();
SceneLoaderList.push_back(externalLoader);
}
//! Returns the number of scene loaders
u32 CSceneManager::getSceneLoaderCount() const
{
return SceneLoaderList.size();
}
//! Retrieve the given scene loader
ISceneLoader* CSceneManager::getSceneLoader(u32 index) const
{
if (index < SceneLoaderList.size())
return SceneLoaderList[index];
else
return 0;
}
//! Returns a pointer to the scene collision manager.
ISceneCollisionManager* CSceneManager::getSceneCollisionManager()
{
@ -1066,72 +1032,6 @@ ISceneNodeFactory* CSceneManager::getSceneNodeFactory(u32 index)
return 0;
}
//! Saves the current scene into a file.
//! \param filename: Name of the file .
bool CSceneManager::saveScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer, ISceneNode* node)
{
bool ret = false;
io::IWriteFile* file = FileSystem->createAndWriteFile(filename);
if (file)
{
ret = saveScene(file, userDataSerializer, node);
file->drop();
}
else
os::Printer::log("Unable to open file", filename, ELL_ERROR);
return ret;
}
//! Saves the current scene into a file.
bool CSceneManager::saveScene(io::IWriteFile* file, ISceneUserDataSerializer* userDataSerializer, ISceneNode* node)
{
return false;
}
//! Loads a scene.
bool CSceneManager::loadScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer, ISceneNode* rootNode)
{
io::IReadFile* file = FileSystem->createAndOpenFile(filename);
if (!file)
{
os::Printer::log("Unable to open scene file", filename.c_str(), ELL_ERROR);
return false;
}
const bool ret = loadScene(file, userDataSerializer, rootNode);
file->drop();
return ret;
}
//! Loads a scene. Note that the current scene is not cleared before.
bool CSceneManager::loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer, ISceneNode* rootNode)
{
if (!file)
{
os::Printer::log("Unable to open scene file", ELL_ERROR);
return false;
}
bool ret = false;
// try scene loaders in reverse order
s32 i = SceneLoaderList.size()-1;
for (; i >= 0 && !ret; --i)
if (SceneLoaderList[i]->isALoadableFileFormat(file))
ret = SceneLoaderList[i]->loadScene(file, userDataSerializer, rootNode);
if (!ret)
os::Printer::log("Could not load scene file, perhaps the format is unsupported: ", file->getFileName().c_str(), ELL_ERROR);
return ret;
}
//! Returns a typename from a scene node type or null if not found
const c8* CSceneManager::getSceneNodeTypeName(ESCENE_NODE_TYPE type)
{
@ -1154,66 +1054,6 @@ ISceneNode* CSceneManager::addSceneNode(const char* sceneNodeTypeName, ISceneNod
return node;
}
//! Writes attributes of the scene node.
void CSceneManager::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const
{
out->addString ("Name", Name.c_str());
out->addInt ("Id", ID );
out->addColorf ("AmbientLight", AmbientLight);
// fog attributes from video driver
video::SColor color;
video::E_FOG_TYPE fogType;
f32 start, end, density;
bool pixelFog, rangeFog;
Driver->getFog(color, fogType, start, end, density, pixelFog, rangeFog);
out->addEnum("FogType", fogType, video::FogTypeNames);
out->addColorf("FogColor", color);
out->addFloat("FogStart", start);
out->addFloat("FogEnd", end);
out->addFloat("FogDensity", density);
out->addBool("FogPixel", pixelFog);
out->addBool("FogRange", rangeFog);
}
//! Reads attributes of the scene node.
void CSceneManager::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)
{
Name = in->getAttributeAsString("Name");
ID = in->getAttributeAsInt("Id");
AmbientLight = in->getAttributeAsColorf("AmbientLight");
// fog attributes
video::SColor color;
video::E_FOG_TYPE fogType;
f32 start, end, density;
bool pixelFog, rangeFog;
if (in->existsAttribute("FogType"))
{
fogType = (video::E_FOG_TYPE) in->getAttributeAsEnumeration("FogType", video::FogTypeNames);
color = in->getAttributeAsColorf("FogColor").toSColor();
start = in->getAttributeAsFloat("FogStart");
end = in->getAttributeAsFloat("FogEnd");
density = in->getAttributeAsFloat("FogDensity");
pixelFog = in->getAttributeAsBool("FogPixel");
rangeFog = in->getAttributeAsBool("FogRange");
Driver->setFog(color, fogType, start, end, density, pixelFog, rangeFog);
}
RelativeTranslation.set(0,0,0);
RelativeRotation.set(0,0,0);
RelativeScale.set(1,1,1);
IsVisible = true;
AutomaticCullingState = scene::EAC_BOX;
DebugDataVisible = scene::EDS_OFF;
IsDebugObject = false;
updateAbsolutePosition();
}
//! Sets ambient color of the scene
void CSceneManager::setAmbientLight(const video::SColorf &ambientColor)
{

View File

@ -137,15 +137,6 @@ namespace scene
//! Retrieve the given mesh loader
virtual IMeshLoader* getMeshLoader(u32 index) const _IRR_OVERRIDE_;
//! Adds an external scene loader.
virtual void addExternalSceneLoader(ISceneLoader* externalLoader) _IRR_OVERRIDE_;
//! Returns the number of scene loaders supported by Irrlicht at this time
virtual u32 getSceneLoaderCount() const _IRR_OVERRIDE_;
//! Retrieve the given scene loader
virtual ISceneLoader* getSceneLoader(u32 index) const _IRR_OVERRIDE_;
//! Returns a pointer to the scene collision manager.
virtual ISceneCollisionManager* getSceneCollisionManager() _IRR_OVERRIDE_;
@ -209,24 +200,6 @@ namespace scene
//! Adds a scene node to the scene by name
virtual ISceneNode* addSceneNode(const char* sceneNodeTypeName, ISceneNode* parent=0) _IRR_OVERRIDE_;
//! Saves the current scene into a file.
virtual bool saveScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0) _IRR_OVERRIDE_;
//! Saves the current scene into a file.
virtual bool saveScene(io::IWriteFile* file, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0) _IRR_OVERRIDE_;
//! Loads a scene. Note that the current scene is not cleared before.
virtual bool loadScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* rootNode=0) _IRR_OVERRIDE_;
//! Loads a scene. Note that the current scene is not cleared before.
virtual bool loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* rootNode=0) _IRR_OVERRIDE_;
//! Writes attributes of the scene node.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_;
//! Reads attributes of the scene node.
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_;
//! Returns a mesh writer implementation if available
virtual IMeshWriter* createMeshWriter(EMESH_WRITER_TYPE type) _IRR_OVERRIDE_;
@ -344,7 +317,6 @@ namespace scene
core::array<ISceneNode*> GuiNodeList;
core::array<IMeshLoader*> MeshLoaderList;
core::array<ISceneLoader*> SceneLoaderList;
core::array<ISceneNode*> DeletionList;
core::array<ISceneNodeFactory*> SceneNodeFactoryList;

View File

@ -48,61 +48,11 @@ public:
virtual s32 getInt() const { return 0; }
virtual f32 getFloat() const { return 0; }
virtual video::SColorf getColorf() const { return video::SColorf(1.0f,1.0f,1.0f,1.0f); }
virtual video::SColor getColor() const { return video::SColor(255,255,255,255); }
virtual core::stringc getString() const { return core::stringc(getStringW().c_str()); }
virtual core::stringw getStringW() const { return core::stringw(); }
virtual core::array<core::stringw> getArray() const { return core::array<core::stringw>(); };
virtual bool getBool() const { return false; }
virtual void getBinary(void* outdata, s32 maxLength) const {};
virtual core::vector3df getVector() const { return core::vector3df(); }
virtual core::position2di getPosition() const { return core::position2di(); }
virtual core::rect<s32> getRect() const { return core::rect<s32>(); }
virtual core::quaternion getQuaternion() const { return core::quaternion(); }
virtual core::matrix4 getMatrix() const { return core::matrix4(); }
virtual core::triangle3df getTriangle() const { return core::triangle3df(); }
virtual core::vector2df getVector2d() const { return core::vector2df(); }
virtual core::vector2di getVector2di() const { return core::vector2di(); }
virtual core::line2df getLine2d() const { return core::line2df(); }
virtual core::line2di getLine2di() const { return core::line2di(); }
virtual core::line3df getLine3d() const { return core::line3df(); }
virtual core::line3di getLine3di() const { return core::line3di(); }
virtual core::dimension2du getDimension2d() const { return core::dimension2du(); }
virtual core::aabbox3d<f32> getBBox() const { return core::aabbox3d<f32>(); }
virtual core::plane3df getPlane() const { return core::plane3df(); }
virtual video::ITexture* getTexture() const { return 0; }
virtual const char* getEnum() const { return 0; }
virtual void* getUserPointer() const { return 0; }
virtual void setInt(s32 intValue) {};
virtual void setFloat(f32 floatValue) {};
virtual void setString(const char* text) {};
virtual void setString(const wchar_t* text){ setString(core::stringc(text).c_str()); };
virtual void setArray(const core::array<core::stringw>& arr ) {};
virtual void setColor(video::SColorf color) {};
virtual void setColor(video::SColor color) {};
virtual void setBool(bool boolValue) {};
virtual void setBinary(void* data, s32 maxLength) {};
virtual void setVector(const core::vector3df& v) {};
virtual void setPosition(const core::position2di& v) {};
virtual void setRect(const core::rect<s32>& v) {};
virtual void setQuaternion(const core::quaternion& v) {};
virtual void setMatrix(const core::matrix4& v) {};
virtual void setTriangle(const core::triangle3df& v) {};
virtual void setVector2d(const core::vector2df& v) {};
virtual void setVector2d(const core::vector2di& v) {};
virtual void setLine2d(const core::line2df& v) {};
virtual void setLine2d(const core::line2di& v) {};
virtual void setLine3d(const core::line3df& v) {};
virtual void setLine3d(const core::line3di& v) {};
virtual void setDimension2d(const core::dimension2du& v) {};
virtual void setBBox(const core::aabbox3d<f32>& v) {};
virtual void setPlane(const core::plane3df& v) {};
virtual void setUserPointer(void* v) {};
virtual void setEnum(const char* enumValue, const char* const* enumerationLiterals) {};
virtual void setTexture(video::ITexture*, const path& filename) {};
core::stringc Name;