Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef PLASTICVERTEXSELECTION_H
Toshihiro Shimizu 890ddd
#define PLASTICVERTEXSELECTION_H
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// TnzQt includes
Toshihiro Shimizu 890ddd
#include "toonzqt/multipleselection.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef DVAPI
Toshihiro Shimizu 890ddd
#undef DVVAR
Toshihiro Shimizu 890ddd
#ifdef TOONZQT_EXPORTS
Toshihiro Shimizu 890ddd
#define DVAPI DV_EXPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_EXPORT_VAR
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
#define DVAPI DV_IMPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_IMPORT_VAR
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//**********************************************************************
Toshihiro Shimizu 890ddd
//    PlasticVertexSelection  definition
Toshihiro Shimizu 890ddd
//**********************************************************************
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*!
Toshihiro Shimizu 890ddd
  \brief    Represents a selection of vertices from the Plastic tool.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
  \details  A Plastic vertex selection is a particular case of
Toshihiro Shimizu 890ddd
            IndexesSelection that also stores the id of the
Toshihiro Shimizu 890ddd
            skeleton containing the indexed vertexes.
Toshihiro Shimizu 890ddd
*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI PlasticVertexSelection : public MultipleSelection<int></int>
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	typedef MultipleSelection<int> base_type;</int>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	int m_skelId; //!< Skeleton Id containing the vertex
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	PlasticVertexSelection(int vIdx = -1, int skelId = -1)
Toshihiro Shimizu 890ddd
		: m_skelId(skelId)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		if (vIdx >= 0)
Toshihiro Shimizu 890ddd
			m_objects.push_back(vIdx);
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//! Constructs from a list of vertex indices
Toshihiro Shimizu 890ddd
	//! \warning The user is responsible for ensuring that the list #does not contain negative indices#
Toshihiro Shimizu 890ddd
	PlasticVertexSelection(const std::vector<int> &vIdxs, int skelId = -1)</int>
Toshihiro Shimizu 890ddd
		: base_type(vIdxs), m_skelId(skelId) {}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void selectNone()
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		m_skelId = -1;
Toshihiro Shimizu 890ddd
		base_type::selectNone();
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	operator int() const
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return (objects().size() == 1) ? objects().front() : -1;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	int skeletonId() const { return m_skelId; }
Toshihiro Shimizu 890ddd
	int &skeletonId() { return m_skelId; }
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif // PLASTICVERTEXSELECTION_H