Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagecpp
linenumberstrue
#include <Atoms/Globals.h>
#include <AtomsCore/Metadata/MapMetadata.h>
#include <Atoms/Loaders/BaseMeshLoader.h>

#define kFooMeshLoaderId 101

namespace Atoms
{
	class ATOMSPLUGIN_EXPORT FooMeshLoader : public BaseMeshLoader
	{
	public:
		//! Type string
		/*!
		\return Class type string
		*/
		std::string typeStr() const;

		//! Class static type string. This is also the file extension of your file format
		static std::string const staticTypeStr;

		//! Type id
		/*!
		\return Class type id
		*/
		unsigned int typeId() const;

		//! Class static type id
		static const unsigned int staticTypeId;

		//! Constructor
		FooMeshLoader();

		//! Destructor
		~FooMeshLoader();

		//! Creator function
		/*!
		\return Return a new AlembicMeshLoader object
		*/
		static AtomsPtr<BaseMeshLoader> creator();

		//! load
		/*!
		Load an atoms file
		*/
		AtomsPtr<AtomsCore::MapMetadata> load(const std::string &filePath, const std::string& filter = "*");
	};
}

namespace Atoms
{
std::string const FooMeshLoader::staticTypeStr = "foo"; // the file extension

std::string FooMeshLoader::typeStr() const
{
	return FooMeshLoader::staticTypeStr;
}

const unsigned int FooMeshLoader::staticTypeId = kAlembicMeshLoaderIdkFooMeshLoaderId;

unsigned int FooMeshLoader::typeId() const
{
	return FooMeshLoader::staticTypeId;
}

FooMeshLoader::FooMeshLoader() :
	BaseMeshLoader()
{
}

FooMeshLoader::~FooMeshLoader()
{
}

AtomsPtr<BaseMeshLoader> FooMeshLoader::creator()
{
	return std::dynamic_pointer_cast<BaseMeshLoader>(std::make_shared<FooMeshLoader>());
}

AtomsPtr<AtomsCore::MapMetadata> FooMeshLoader::load(const std::string &filePath, const std::string& filter = "*")
{
	AtomsPtr<AtomsCore::MapMetadata>  skinMeshMetadata(new AtomsCore::MapMetadata);
	std::string fullPath = AtomsUtils::solvePath(filePath);
	std::vector<std::string> filterVec;
	if ((filter != "*") || (filter != ""))
	{
		AtomsUtils::splitString(AtomsUtils::eraseFromString(filter, ' '), ',', filterVec);
	}

	//load your mesh file here and start to fill the mapmetadata
	for (const std::string& geoName: fooGeoFileList)
	{
		//Check if the current geo is passing the filter
		if ((filterVec.size() > 0) && (!AtomsUtils::filterNames(filterVec, geoName)))
			continue;
	}

	...
	return skinMeshMetadata;
}
}

...