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

@ -1,71 +0,0 @@
// Copyright (C) 2002-2012 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_ATTRIBUTE_EXCHANGING_OBJECT_H_INCLUDED__
#define __I_ATTRIBUTE_EXCHANGING_OBJECT_H_INCLUDED__
#include "IReferenceCounted.h"
namespace irr
{
namespace io
{
class IAttributes;
//! Enumeration flags passed through SAttributeReadWriteOptions to the IAttributeExchangingObject object
enum E_ATTRIBUTE_READ_WRITE_FLAGS
{
//! Serialization/Deserializion is done for an xml file
EARWF_FOR_FILE = 0x00000001,
//! Serialization/Deserializion is done for an editor property box
EARWF_FOR_EDITOR = 0x00000002,
//! When writing filenames, relative paths should be used
EARWF_USE_RELATIVE_PATHS = 0x00000004
};
//! struct holding data describing options
struct SAttributeReadWriteOptions
{
//! Constructor
SAttributeReadWriteOptions()
: Flags(0), Filename(0)
{
}
//! Combination of E_ATTRIBUTE_READ_WRITE_FLAGS or other, custom ones
s32 Flags;
//! Optional filename
const fschar_t* Filename;
};
//! An object which is able to serialize and deserialize its attributes into an attributes object
class IAttributeExchangingObject : virtual public IReferenceCounted
{
public:
//! 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 {}
//! 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) {}
};
} // end namespace io
} // end namespace irr
#endif

View File

@ -125,133 +125,9 @@ public:
//! Sets an attribute as float value
virtual void setAttribute(s32 index, f32 value) = 0;
/*
String Attribute
*/
//! Adds an attribute as string
virtual void addString(const c8* attributeName, const c8* value) = 0;
//! 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) = 0;
//! 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 = 0;
//! 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 = 0;
//! 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 = 0;
//! Sets an attribute value as string.
//! \param index Index value, must be between 0 and getAttributeCount()-1.
//! \param value String to which the attribute is set.
virtual void setAttribute(s32 index, const c8* value) = 0;
// wide strings
//! Adds an attribute as string
virtual void addString(const c8* attributeName, const wchar_t* value) = 0;
//! 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) = 0;
//! 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 = 0;
//! 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 = 0;
//! 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 = 0;
//! Sets an attribute value as string.
//! \param index Index value, must be between 0 and getAttributeCount()-1.
//! \param value String to which the attribute is set.
virtual void setAttribute(s32 index, const wchar_t* value) = 0;
/*
Binary Data Attribute
*/
//! Adds an attribute as binary data
virtual void addBinary(const c8* attributeName, void* data, s32 dataSizeInBytes) = 0;
//! Sets an attribute as binary data
virtual void setAttribute(const c8* attributeName, void* data, s32 dataSizeInBytes ) = 0;
//! Gets an attribute as binary data
/** \param attributeName: Name of the attribute to get.
\param outData Pointer to buffer where data shall be stored.
\param maxSizeInBytes Maximum number of bytes to write into outData.
*/
virtual void getAttributeAsBinaryData(const c8* attributeName, void* outData, s32 maxSizeInBytes) const = 0;
//! Gets an attribute as binary data
/** \param index: Index value, must be between 0 and getAttributeCount()-1.
\param outData Pointer to buffer where data shall be stored.
\param maxSizeInBytes Maximum number of bytes to write into outData.
*/
virtual void getAttributeAsBinaryData(s32 index, void* outData, s32 maxSizeInBytes) const = 0;
//! Sets an attribute as binary data
virtual void setAttribute(s32 index, void* data, s32 dataSizeInBytes ) = 0;
/*
Array Attribute
*/
//! Adds an attribute as wide string array
virtual void addArray(const c8* attributeName, const core::array<core::stringw>& value) = 0;
//! 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) = 0;
//! 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 = 0;
//! 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 = 0;
//! Sets an attribute as an array of wide strings
virtual void setAttribute(s32 index, const core::array<core::stringw>& value) = 0;
/*
Bool Attribute
*/
//! Adds an attribute as bool
@ -273,476 +149,9 @@ public:
//! Sets an attribute as boolean value
virtual void setAttribute(s32 index, bool value) = 0;
/*
Enumeration Attribute
*/
//! Adds an attribute as enum
virtual void addEnum(const c8* attributeName, const c8* enumValue, const c8* const* enumerationLiterals) = 0;
//! Adds an attribute as enum
virtual void addEnum(const c8* attributeName, s32 enumValue, const c8* const* enumerationLiterals) = 0;
//! Sets an attribute as enumeration
virtual void setAttribute(const c8* attributeName, const c8* enumValue, const c8* const* enumerationLiterals) = 0;
//! 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 = 0;
//! 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 = -1) const = 0;
//! Gets an attribute as enumeration
/** \param index: Index value, must be between 0 and getAttributeCount()-1.
\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.
\param defaultNotFound Value returned when the attribute referenced by the index was not found.
\return Returns value of the attribute previously set by setAttribute()
*/
virtual s32 getAttributeAsEnumeration(s32 index, const c8* const* enumerationLiteralsToUse, s32 defaultNotFound = -1) const = 0;
//! Gets an attribute as enumeration
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual const c8* getAttributeAsEnumeration(s32 index) const = 0;
//! Gets the list of enumeration literals of an enumeration attribute
//! \param attributeName Name of the attribute to get.
//! \param outLiterals Set of strings to choose the enum name from.
virtual void getAttributeEnumerationLiteralsOfEnumeration(const c8* attributeName, core::array<core::stringc>& outLiterals) const = 0;
//! Gets the list of enumeration literals of an enumeration attribute
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
//! \param outLiterals Set of strings to choose the enum name from.
virtual void getAttributeEnumerationLiteralsOfEnumeration(s32 index, core::array<core::stringc>& outLiterals) const = 0;
//! Sets an attribute as enumeration
virtual void setAttribute(s32 index, const c8* enumValue, const c8* const* enumerationLiterals) = 0;
/*
SColor Attribute
*/
//! Adds an attribute as color
virtual void addColor(const c8* attributeName, video::SColor value) = 0;
//! Sets a attribute as color
virtual void setAttribute(const c8* attributeName, video::SColor color) = 0;
//! 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 = 0;
//! Gets an attribute as color
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual video::SColor getAttributeAsColor(s32 index) const = 0;
//! Sets an attribute as color
virtual void setAttribute(s32 index, video::SColor color) = 0;
/*
SColorf Attribute
*/
//! Adds an attribute as floating point color
virtual void addColorf(const c8* attributeName, video::SColorf value) = 0;
//! Sets a attribute as floating point color
virtual void setAttribute(const c8* attributeName, video::SColorf color) = 0;
//! 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 = 0;
//! 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 = 0;
//! Sets an attribute as floating point color
virtual void setAttribute(s32 index, video::SColorf color) = 0;
/*
Vector3d Attribute
*/
//! Adds an attribute as 3d vector
virtual void addVector3d(const c8* attributeName, const core::vector3df& value) = 0;
//! Sets a attribute as 3d vector
virtual void setAttribute(const c8* attributeName, const core::vector3df& v) = 0;
//! 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 = 0;
//! Gets an attribute as 3d vector
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual core::vector3df getAttributeAsVector3d(s32 index) const = 0;
//! Sets an attribute as vector
virtual void setAttribute(s32 index, const core::vector3df& v) = 0;
/*
Vector2d Attribute
*/
//! Adds an attribute as 2d vector
virtual void addVector2d(const c8* attributeName, const core::vector2df& value) = 0;
//! Sets a attribute as 2d vector
virtual void setAttribute(const c8* attributeName, const core::vector2df& v) = 0;
//! Gets an attribute as 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 = 0;
//! Gets an attribute as position
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual core::vector2df getAttributeAsVector2d(s32 index) const = 0;
//! Sets an attribute as 2d vector
virtual void setAttribute(s32 index, const core::vector2df& v) = 0;
/*
Position2d Attribute
*/
//! Adds an attribute as 2d position
virtual void addPosition2d(const c8* attributeName, const core::position2di& value) = 0;
//! Sets a attribute as 2d position
virtual void setAttribute(const c8* attributeName, const core::position2di& v) = 0;
//! 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 = 0;
//! Gets an attribute as position
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual core::position2di getAttributeAsPosition2d(s32 index) const = 0;
//! Sets an attribute as 2d position
virtual void setAttribute(s32 index, const core::position2di& v) = 0;
/*
Rectangle Attribute
*/
//! Adds an attribute as rectangle
virtual void addRect(const c8* attributeName, const core::rect<s32>& value) = 0;
//! Sets an attribute as rectangle
virtual void setAttribute(const c8* attributeName, const core::rect<s32>& v) = 0;
//! 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 = 0;
//! Gets an attribute as rectangle
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual core::rect<s32> getAttributeAsRect(s32 index) const = 0;
//! Sets an attribute as rectangle
virtual void setAttribute(s32 index, const core::rect<s32>& v) = 0;
/*
Dimension2d Attribute
*/
//! Adds an attribute as dimension2d
virtual void addDimension2d(const c8* attributeName, const core::dimension2d<u32>& value) = 0;
//! Sets an attribute as dimension2d
virtual void setAttribute(const c8* attributeName, const core::dimension2d<u32>& v) = 0;
//! 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 = 0;
//! Gets an attribute as dimension2d
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual core::dimension2d<u32> getAttributeAsDimension2d(s32 index) const = 0;
//! Sets an attribute as dimension2d
virtual void setAttribute(s32 index, const core::dimension2d<u32>& v) = 0;
/*
matrix attribute
*/
//! Adds an attribute as matrix
virtual void addMatrix(const c8* attributeName, const core::matrix4& v) = 0;
//! Sets an attribute as matrix
virtual void setAttribute(const c8* attributeName, const core::matrix4& v) = 0;
//! 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 = 0;
//! Gets an attribute as matrix
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual core::matrix4 getAttributeAsMatrix(s32 index) const = 0;
//! Sets an attribute as matrix
virtual void setAttribute(s32 index, const core::matrix4& v) = 0;
/*
quaternion attribute
*/
//! Adds an attribute as quaternion
virtual void addQuaternion(const c8* attributeName, const core::quaternion& v) = 0;
//! Sets an attribute as quaternion
virtual void setAttribute(const c8* attributeName, const core::quaternion& v) = 0;
//! 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 = 0;
//! Gets an attribute as quaternion
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual core::quaternion getAttributeAsQuaternion(s32 index) const = 0;
//! Sets an attribute as quaternion
virtual void setAttribute(s32 index, const core::quaternion& v) = 0;
/*
3d bounding box
*/
//! Adds an attribute as axis aligned bounding box
virtual void addBox3d(const c8* attributeName, const core::aabbox3df& v) = 0;
//! Sets an attribute as axis aligned bounding box
virtual void setAttribute(const c8* attributeName, const core::aabbox3df& v) = 0;
//! 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 = 0;
//! 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 = 0;
//! Sets an attribute as axis aligned bounding box
virtual void setAttribute(s32 index, const core::aabbox3df& v) = 0;
/*
plane
*/
//! Adds an attribute as 3d plane
virtual void addPlane3d(const c8* attributeName, const core::plane3df& v) = 0;
//! Sets an attribute as 3d plane
virtual void setAttribute(const c8* attributeName, const core::plane3df& v) = 0;
//! 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 = 0;
//! Gets an attribute as 3d plane
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual core::plane3df getAttributeAsPlane3d(s32 index) const = 0;
//! Sets an attribute as 3d plane
virtual void setAttribute(s32 index, const core::plane3df& v) = 0;
/*
3d triangle
*/
//! Adds an attribute as 3d triangle
virtual void addTriangle3d(const c8* attributeName, const core::triangle3df& v) = 0;
//! Sets an attribute as 3d trianle
virtual void setAttribute(const c8* attributeName, const core::triangle3df& v) = 0;
//! 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 = 0;
//! Gets an attribute as 3d triangle
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual core::triangle3df getAttributeAsTriangle3d(s32 index) const = 0;
//! Sets an attribute as 3d triangle
virtual void setAttribute(s32 index, const core::triangle3df& v) = 0;
/*
line 2d
*/
//! Adds an attribute as a 2d line
virtual void addLine2d(const c8* attributeName, const core::line2df& v) = 0;
//! Sets an attribute as a 2d line
virtual void setAttribute(const c8* attributeName, const core::line2df& v) = 0;
//! 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 = 0;
//! 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 = 0;
//! Sets an attribute as a 2d line
virtual void setAttribute(s32 index, const core::line2df& v) = 0;
/*
line 3d
*/
//! Adds an attribute as a 3d line
virtual void addLine3d(const c8* attributeName, const core::line3df& v) = 0;
//! Sets an attribute as a 3d line
virtual void setAttribute(const c8* attributeName, const core::line3df& v) = 0;
//! 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 = 0;
//! 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 = 0;
//! Sets an attribute as a 3d line
virtual void setAttribute(s32 index, const core::line3df& v) = 0;
/*
Texture Attribute
*/
//! Adds an attribute as texture reference
virtual void addTexture(const c8* attributeName, video::ITexture* texture, const io::path& filename = "") = 0;
//! Sets an attribute as texture reference
virtual void setAttribute(const c8* attributeName, video::ITexture* texture, const io::path& filename = "") = 0;
//! 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 = 0;
//! Gets an attribute as texture reference
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual video::ITexture* getAttributeAsTexture(s32 index) const = 0;
//! Sets an attribute as texture reference
virtual void setAttribute(s32 index, video::ITexture* texture, const io::path& filename = "") = 0;
/*
User Pointer Attribute
*/
//! Adds an attribute as user pointer
virtual void addUserPointer(const c8* attributeName, void* userPointer) = 0;
//! Sets an attribute as user pointer
virtual void setAttribute(const c8* attributeName, void* userPointer) = 0;
//! 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 = 0;
//! Gets an attribute as user pointer
//! \param index: Index value, must be between 0 and getAttributeCount()-1.
virtual void* getAttributeAsUserPointer(s32 index) const = 0;
//! Sets an attribute as user pointer
virtual void setAttribute(s32 index, void* userPointer) = 0;
};
} // end namespace io
} // end namespace irr
#endif

View File

@ -172,27 +172,6 @@ namespace scene
/** @see bindTargetAndRotation() */
virtual bool getTargetAndRotationBinding(void) const =0;
//! Writes attributes of the camera node
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_
{
ISceneNode::serializeAttributes(out, options);
if (!out)
return;
out->addBool("IsOrthogonal", IsOrthogonal);
}
//! Reads attributes of the camera node
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_
{
ISceneNode::deserializeAttributes(in, options);
if (!in)
return;
if ( in->findAttribute("IsOrthogonal") )
IsOrthogonal = in->getAttributeAsBool("IsOrthogonal");
}
protected:
void cloneMembers(const ICameraSceneNode* toCopyFrom)

View File

@ -315,14 +315,6 @@ public:
/** \param filename is the string identifying the file which should be tested for existence.
\return True if file exists, and false if it does not exist or an error occurred. */
virtual bool existFile(const path& filename) const =0;
//! Creates a new empty collection of attributes, usable for serialization and more.
/** \param driver: Video driver to be used to load textures when specified as attribute values.
Can be null to prevent automatic texture loading by attributes.
\return Pointer to the created object.
If you no longer need the object, you should call IAttributes::drop().
See IReferenceCounted::drop() for more information. */
virtual IAttributes* createEmptyAttributes(video::IVideoDriver* driver=0) =0;
};

View File

@ -5,7 +5,7 @@
#ifndef __I_GUI_ELEMENT_H_INCLUDED__
#define __I_GUI_ELEMENT_H_INCLUDED__
#include "IAttributeExchangingObject.h"
#include "IReferenceCounted.h"
#include "irrList.h"
#include "rect.h"
#include "irrString.h"
@ -20,7 +20,7 @@ namespace irr
namespace gui
{
//! Base class of all GUI elements.
class IGUIElement : public virtual io::IAttributeExchangingObject, public IEventReceiver
class IGUIElement : virtual public IReferenceCounted, public IEventReceiver
{
public:
@ -210,25 +210,25 @@ public:
}
//! How left element border is aligned when parent is resized
EGUI_ALIGNMENT getAlignLeft() const
EGUI_ALIGNMENT getAlignLeft() const
{
return AlignLeft;
}
//! How right element border is aligned when parent is resized
EGUI_ALIGNMENT getAlignRight() const
EGUI_ALIGNMENT getAlignRight() const
{
return AlignRight;
}
//! How top element border is aligned when parent is resized
EGUI_ALIGNMENT getAlignTop() const
EGUI_ALIGNMENT getAlignTop() const
{
return AlignTop;
}
//! How bottom element border is aligned when parent is resized
EGUI_ALIGNMENT getAlignBottom() const
EGUI_ALIGNMENT getAlignBottom() const
{
return AlignBottom;
}
@ -796,62 +796,6 @@ public:
}
//! Writes attributes of the scene node.
/** Implement this to expose the attributes of your scene node for
scripting languages, editors, debuggers or xml serialization purposes. */
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_
{
out->addString("Name", Name.c_str());
out->addInt("Id", ID );
out->addString("Caption", getText());
out->addString("ToolTip", getToolTipText().c_str());
out->addRect("Rect", DesiredRect);
out->addPosition2d("MinSize", core::position2di(MinSize.Width, MinSize.Height));
out->addPosition2d("MaxSize", core::position2di(MaxSize.Width, MaxSize.Height));
out->addEnum("LeftAlign", AlignLeft, GUIAlignmentNames);
out->addEnum("RightAlign", AlignRight, GUIAlignmentNames);
out->addEnum("TopAlign", AlignTop, GUIAlignmentNames);
out->addEnum("BottomAlign", AlignBottom, GUIAlignmentNames);
out->addBool("Visible", IsVisible);
out->addBool("Enabled", IsEnabled);
out->addBool("TabStop", IsTabStop);
out->addBool("TabGroup", IsTabGroup);
out->addInt("TabOrder", TabOrder);
out->addBool("NoClip", NoClip);
}
//! Reads attributes of the scene node.
/** Implement this to set the attributes of your scene node for
scripting languages, editors, debuggers or xml deserialization purposes. */
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_
{
setName(in->getAttributeAsString("Name", Name));
setID(in->getAttributeAsInt("Id", ID));
setText(in->getAttributeAsStringW("Caption", Text).c_str());
setToolTipText(in->getAttributeAsStringW("ToolTip").c_str());
setVisible(in->getAttributeAsBool("Visible", IsVisible));
setEnabled(in->getAttributeAsBool("Enabled", IsEnabled));
IsTabStop = in->getAttributeAsBool("TabStop", IsTabStop);
IsTabGroup = in->getAttributeAsBool("TabGroup", IsTabGroup);
TabOrder = in->getAttributeAsInt("TabOrder", TabOrder);
core::position2di p = in->getAttributeAsPosition2d("MaxSize", core::position2di(MaxSize.Width, MaxSize.Height));
setMaxSize(core::dimension2du(p.X,p.Y));
p = in->getAttributeAsPosition2d("MinSize", core::position2di(MinSize.Width, MinSize.Height));
setMinSize(core::dimension2du(p.X,p.Y));
setAlignment((EGUI_ALIGNMENT) in->getAttributeAsEnumeration("LeftAlign", GUIAlignmentNames, AlignLeft),
(EGUI_ALIGNMENT)in->getAttributeAsEnumeration("RightAlign", GUIAlignmentNames, AlignRight),
(EGUI_ALIGNMENT)in->getAttributeAsEnumeration("TopAlign", GUIAlignmentNames, AlignTop),
(EGUI_ALIGNMENT)in->getAttributeAsEnumeration("BottomAlign", GUIAlignmentNames, AlignBottom));
setRelativePosition(in->getAttributeAsRect("Rect", DesiredRect));
setNotClipped(in->getAttributeAsBool("NoClip", NoClip));
}
protected:
// not virtual because needed in constructor
void addChildToEnd(IGUIElement* child)

View File

@ -618,12 +618,6 @@ public:
\return True if loading succeeded, else false. */
virtual bool loadGUI(io::IReadFile* file, IGUIElement* parent=0) = 0;
//! Writes attributes of the gui environment
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const =0;
//! Reads attributes of the gui environment
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)=0;
//! Find the next element which would be selected when pressing the tab-key
/** If you set the focus for the result you can manually force focus-changes like they
would happen otherwise by the tab-keys.

View File

@ -5,7 +5,7 @@
#ifndef __I_GUI_SKIN_H_INCLUDED__
#define __I_GUI_SKIN_H_INCLUDED__
#include "IAttributeExchangingObject.h"
#include "IReferenceCounted.h"
#include "EGUIAlignment.h"
#include "SColor.h"
#include "rect.h"
@ -381,7 +381,7 @@ namespace gui
};
//! A skin modifies the look of the GUI elements.
class IGUISkin : public virtual io::IAttributeExchangingObject
class IGUISkin : virtual public IReferenceCounted
{
public:

View File

@ -1,62 +0,0 @@
// Copyright (C) 2010-2012 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_SCENE_LOADER_H_INCLUDED__
#define __I_SCENE_LOADER_H_INCLUDED__
#include "IReferenceCounted.h"
#include "path.h"
namespace irr
{
namespace io
{
class IReadFile;
} // end namespace io
namespace scene
{
class ISceneNode;
class ISceneUserDataSerializer;
//! Class which can load a scene into the scene manager.
/** If you want Irrlicht to be able to load currently unsupported
scene file formats (e.g. .vrml), then implement this and add your
new Sceneloader to the engine with ISceneManager::addExternalSceneLoader(). */
class ISceneLoader : public virtual IReferenceCounted
{
public:
//! Returns true if the class might be able to load this file.
/** This decision should be based on the file extension (e.g. ".vrml")
only.
\param filename Name of the file to test.
\return True if the extension is a recognised type. */
virtual bool isALoadableFileExtension(const io::path& filename) const = 0;
//! Returns true if the class might be able to load this file.
/** This decision will be based on a quick look at the contents of the file.
\param file The file to test.
\return True if the extension is a recognised type. */
virtual bool isALoadableFileFormat(io::IReadFile* file) const = 0;
//! Loads the scene into the scene manager.
/** \param file File which contains the scene.
\param userDataSerializer: If you want to load user data which may be attached
to some some scene nodes in the file, implement the ISceneUserDataSerializer
interface and provide it as parameter here. Otherwise, simply specify 0 as this
parameter.
\param rootNode The node to load the scene into, if none is provided then the
scene will be loaded into the root node.
\return Returns true on success, false on failure. Returns 0 if loading failed. */
virtual bool loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer=0,
ISceneNode* rootNode=0) = 0;
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -110,10 +110,8 @@ namespace scene
class IMeshManipulator;
class IMeshSceneNode;
class IMeshWriter;
class ISceneLoader;
class ISceneNode;
class ISceneNodeFactory;
class ISceneUserDataSerializer;
//! The Scene Manager manages scene nodes, mesh resources, cameras and all the other stuff.
/** All Scene nodes can be created only here.
@ -560,24 +558,6 @@ namespace scene
\return A pointer to the specified loader, 0 if the index is incorrect. */
virtual IMeshLoader* getMeshLoader(u32 index) const = 0;
//! Adds an external scene loader for extending the engine with new file formats.
/** If you want the engine to be extended with
file formats it currently is not able to load (e.g. .vrml), just implement
the ISceneLoader interface in your loading class and add it with this method.
Using this method it is also possible to override the built-in scene loaders
with newer or updated versions without the need to recompile the engine.
\param externalLoader: Implementation of a new mesh loader. */
virtual void addExternalSceneLoader(ISceneLoader* externalLoader) = 0;
//! Returns the number of scene loaders supported by Irrlicht at this time
virtual u32 getSceneLoaderCount() const = 0;
//! Retrieve the given scene loader
/** \param index The index of the loader to retrieve. This parameter is an 0-based
array index.
\return A pointer to the specified loader, 0 if the index is incorrect. */
virtual ISceneLoader* getSceneLoader(u32 index) const = 0;
//! Get pointer to the scene collision manager.
/** \return Pointer to the collision manager
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
@ -669,80 +649,6 @@ namespace scene
See IReferenceCounted::drop() for more information. */
virtual ISceneManager* createNewSceneManager(bool cloneContent=false) = 0;
//! Saves the current scene into a file.
/** Scene nodes with the option isDebugObject set to true are
not being saved. The scene is usually written to an .irr file,
an xml based format. .irr files can Be edited with the Irrlicht
Engine Editor, irrEdit (http://www.ambiera.com/irredit/). To
load .irr files again, see ISceneManager::loadScene().
\param filename Name of the file.
\param userDataSerializer If you want to save some user data
for every scene node into the file, implement the
ISceneUserDataSerializer interface and provide it as parameter
here. Otherwise, simply specify 0 as this parameter.
\param node Node which is taken as the top node of the scene.
This node and all of its descendants are saved into the scene
file. Pass 0 or the scene manager to save the full scene (which
is also the default).
\return True if successful. */
virtual bool saveScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0) = 0;
//! Saves the current scene into a file.
/** Scene nodes with the option isDebugObject set to true are
not being saved. The scene is usually written to an .irr file,
an xml based format. .irr files can Be edited with the Irrlicht
Engine Editor, irrEdit (http://www.ambiera.com/irredit/). To
load .irr files again, see ISceneManager::loadScene().
\param file File where the scene is saved into.
\param userDataSerializer If you want to save some user data
for every scene node into the file, implement the
ISceneUserDataSerializer interface and provide it as parameter
here. Otherwise, simply specify 0 as this parameter.
\param node Node which is taken as the top node of the scene.
This node and all of its descendants are saved into the scene
file. Pass 0 or the scene manager to save the full scene (which
is also the default).
\return True if successful. */
virtual bool saveScene(io::IWriteFile* file, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0) = 0;
//! Loads a scene. Note that the current scene is not cleared before.
/** The scene is usually loaded from an .irr file, an xml based
format, but other scene formats can be added to the engine via
ISceneManager::addExternalSceneLoader. .irr files can Be edited
with the Irrlicht Engine Editor, irrEdit
(http://www.ambiera.com/irredit/) or saved directly by the engine
using ISceneManager::saveScene().
\param filename Name of the file to load from.
\param userDataSerializer If you want to load user data
possibily saved in that file for some scene nodes in the file,
implement the ISceneUserDataSerializer interface and provide it
as parameter here. Otherwise, simply specify 0 as this
parameter.
\param rootNode Node which is taken as the root node of the
scene. Pass 0 to add the scene directly to the scene manager
(which is also the default).
\return True if successful. */
virtual bool loadScene(const io::path& filename, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* rootNode=0) = 0;
//! Loads a scene. Note that the current scene is not cleared before.
/** The scene is usually loaded from an .irr file, an xml based
format, but other scene formats can be added to the engine via
ISceneManager::addExternalSceneLoader. .irr files can Be edited
with the Irrlicht Engine Editor, irrEdit
(http://www.ambiera.com/irredit/) or saved directly by the engine
using ISceneManager::saveScene().
\param file File where the scene is loaded from.
\param userDataSerializer If you want to load user data
saved in that file for some scene nodes in the file,
implement the ISceneUserDataSerializer interface and provide it
as parameter here. Otherwise, simply specify 0 as this
parameter.
\param rootNode Node which is taken as the root node of the
scene. Pass 0 to add the scene directly to the scene manager
(which is also the default).
\return True if successful. */
virtual bool loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* rootNode=0) = 0;
//! Get a mesh writer implementation if available
/** Note: You need to drop() the pointer after use again, see IReferenceCounted::drop()
for details. */

View File

@ -5,7 +5,7 @@
#ifndef __I_SCENE_NODE_H_INCLUDED__
#define __I_SCENE_NODE_H_INCLUDED__
#include "IAttributeExchangingObject.h"
#include "IReferenceCounted.h"
#include "ESceneNodeTypes.h"
#include "ECullingTypes.h"
#include "EDebugSceneTypes.h"
@ -34,7 +34,7 @@ namespace scene
example easily possible to attach a light to a moving car, or to place
a walking character on a moving platform on a moving ship.
*/
class ISceneNode : virtual public io::IAttributeExchangingObject
class ISceneNode : virtual public IReferenceCounted
{
public:
@ -571,67 +571,6 @@ namespace scene
return ESNT_UNKNOWN;
}
//! Writes attributes of the scene node.
/** Implement this to expose the attributes of your scene node
for scripting languages, editors, debuggers or xml
serialization purposes.
\param out The attribute container to write into.
\param options Additional options which might influence the
serialization. */
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_
{
if (!out)
return;
out->addString("Name", Name.c_str());
out->addInt("Id", ID );
out->addVector3d("Position", getPosition() );
out->addVector3d("Rotation", getRotation() );
out->addVector3d("Scale", getScale() );
out->addBool("Visible", IsVisible );
out->addInt("AutomaticCulling", AutomaticCullingState);
out->addInt("DebugDataVisible", DebugDataVisible );
out->addBool("IsDebugObject", IsDebugObject );
}
//! Reads attributes of the scene node.
/** Implement this to set the attributes of your scene node for
scripting languages, editors, debuggers or xml deserialization
purposes.
\param in The attribute container to read from.
\param options Additional options which might influence the
deserialization. */
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_
{
if (!in)
return;
Name = in->getAttributeAsString("Name", Name);
ID = in->getAttributeAsInt("Id", ID);
setPosition(in->getAttributeAsVector3d("Position", RelativeTranslation));
setRotation(in->getAttributeAsVector3d("Rotation", RelativeRotation));
setScale(in->getAttributeAsVector3d("Scale", RelativeScale));
IsVisible = in->getAttributeAsBool("Visible", IsVisible);
if (in->existsAttribute("AutomaticCulling"))
{
s32 tmpState = in->getAttributeAsEnumeration("AutomaticCulling",
scene::AutomaticCullingNames);
if (tmpState != -1)
AutomaticCullingState = (u32)tmpState;
else
AutomaticCullingState = in->getAttributeAsInt("AutomaticCulling");
}
DebugDataVisible = in->getAttributeAsInt("DebugDataVisible", DebugDataVisible);
IsDebugObject = in->getAttributeAsBool("IsDebugObject", IsDebugObject);
updateAbsolutePosition();
}
//! Creates a clone of this scene node and its children.
/** \param newParent An optional new parent.
\param newManager An optional new scene manager.

View File

@ -1,51 +0,0 @@
// Copyright (C) 2002-2012 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_SCENE_USER_DATA_SERIALIZER_H_INCLUDED__
#define __I_SCENE_USER_DATA_SERIALIZER_H_INCLUDED__
#include "IReferenceCounted.h"
namespace irr
{
namespace io
{
class IAttributes;
} // end namespace io
namespace scene
{
class ISceneNode;
//! Interface to read and write user data to and from .irr files.
/** This interface is to be implemented by the user, to make it possible to read
and write user data when reading or writing .irr files via ISceneManager.
To be used with ISceneManager::loadScene() and ISceneManager::saveScene() */
class ISceneUserDataSerializer
{
public:
virtual ~ISceneUserDataSerializer() {}
//! Called when the scene manager create a scene node while loading a file.
virtual void OnCreateNode(ISceneNode* node) = 0;
//! Called when the scene manager read a scene node while loading a file.
/** The userData pointer contains a list of attributes with userData which
were attached to the scene node in the read scene file.*/
virtual void OnReadUserData(ISceneNode* forSceneNode, io::IAttributes* userData) = 0;
//! Called when the scene manager is writing a scene node to an xml file for example.
/** Implement this method and return a list of attributes containing the user data
you want to be saved together with the scene node. Return 0 if no user data should
be added. Please note that the scene manager will call drop() to the returned pointer
after it no longer needs it, so if you didn't create a new object for the return value
and returning a longer existing IAttributes object, simply call grab() before returning it. */
virtual io::IAttributes* createUserData(ISceneNode* forSceneNode) = 0;
};
} // end namespace scene
} // end namespace irr
#endif

View File

@ -25,7 +25,6 @@ namespace irr
namespace io
{
class IAttributes;
struct SAttributeReadWriteOptions;
class IReadFile;
class IWriteFile;
} // end namespace io
@ -1341,28 +1340,6 @@ namespace video
When false the names will stay at the original index */
virtual void swapMaterialRenderers(u32 idx1, u32 idx2, bool swapNames=true) = 0;
//! Creates material attributes list from a material
/** This method is useful for serialization and more.
Please note that the video driver will use the material
renderer names from getMaterialRendererName() to write out the
material type name, so they should be set before.
\param material The material to serialize.
\param options Additional options which might influence the
serialization.
\return The io::IAttributes container holding the material
properties. */
virtual io::IAttributes* createAttributesFromMaterial(const video::SMaterial& material,
io::SAttributeReadWriteOptions* options=0) =0;
//! Fills an SMaterial structure from attributes.
/** Please note that for setting material types of the
material, the video driver will need to query the material
renderers for their names, so all non built-in materials must
have been created before calling this method.
\param outMaterial The material to set the properties for.
\param attributes The attributes to read from. */
virtual void fillMaterialStructureFromAttributes(video::SMaterial& outMaterial, io::IAttributes* attributes) =0;
//! Returns driver and operating system specific data about the IVideoDriver.
/** This method should only be used if the engine should be
extended without having to modify the source of the engine.

View File

@ -48,32 +48,6 @@ namespace scene
**/
const c8* const OBJ_LOADER_IGNORE_MATERIAL_FILES = "OBJ_IgnoreMaterialFiles";
//! Flag to ignore the b3d file's mipmapping flag
/** Instead Irrlicht's texture creation flag is used. Use it like this:
\code
SceneManager->getParameters()->setAttribute(scene::B3D_LOADER_IGNORE_MIPMAP_FLAG, true);
\endcode
**/
const c8* const B3D_LOADER_IGNORE_MIPMAP_FLAG = "B3D_IgnoreMipmapFlag";
//! Name of the parameter for setting the length of debug normals.
/** Use it like this:
\code
SceneManager->getParameters()->setAttribute(scene::DEBUG_NORMAL_LENGTH, 1.5f);
\endcode
**/
const c8* const DEBUG_NORMAL_LENGTH = "DEBUG_Normal_Length";
//! Name of the parameter for setting the color of debug normals.
/** Use it like this:
\code
SceneManager->getParameters()->setAttributeAsColor(scene::DEBUG_NORMAL_COLOR, video::SColor(255, 255, 255, 255));
\endcode
**/
const c8* const DEBUG_NORMAL_COLOR = "DEBUG_Normal_Color";
} // end namespace scene
} // end namespace irr

View File

@ -53,7 +53,6 @@
#include "heapsort.h"
#include "IAnimatedMesh.h"
#include "IAnimatedMeshSceneNode.h"
#include "IAttributeExchangingObject.h"
#include "IAttributes.h"
#include "IBillboardSceneNode.h"
#include "IBoneSceneNode.h"
@ -120,11 +119,9 @@
#include "irrTypes.h"
#include "path.h"
#include "ISceneCollisionManager.h"
#include "ISceneLoader.h"
#include "ISceneManager.h"
#include "ISceneNode.h"
#include "ISceneNodeFactory.h"
#include "ISceneUserDataSerializer.h"
#include "IShaderConstantSetCallBack.h"
#include "ISkinnedMesh.h"
#include "ITexture.h"