Shinya Kitaoka 810553
#pragma once
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
Shinya Kitaoka 120a6e
class DVAPI PlasticVertexSelection : public MultipleSelection<int> {</int>
Shinya Kitaoka 120a6e
  typedef MultipleSelection<int> base_type;</int>
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  int m_skelId;  //!< Skeleton Id containing the vertex
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  PlasticVertexSelection(int vIdx = -1, int skelId = -1) : m_skelId(skelId) {
Shinya Kitaoka 120a6e
    if (vIdx >= 0) m_objects.push_back(vIdx);
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  //! Constructs from a list of vertex indices
Shinya Kitaoka 120a6e
  //! \warning The user is responsible for ensuring that the list #does not
Shinya Kitaoka 120a6e
  //! contain negative indices#
Shinya Kitaoka 120a6e
  PlasticVertexSelection(const std::vector<int> &vIdxs, int skelId = -1)</int>
Shinya Kitaoka 120a6e
      : base_type(vIdxs), m_skelId(skelId) {}
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  void selectNone() {
Shinya Kitaoka 120a6e
    m_skelId = -1;
Shinya Kitaoka 120a6e
    base_type::selectNone();
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  operator int() const {
Shinya Kitaoka 120a6e
    return (objects().size() == 1) ? objects().front() : -1;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  int skeletonId() const { return m_skelId; }
Shinya Kitaoka 120a6e
  int &skeletonId() { return m_skelId; }
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
#endif  // PLASTICVERTEXSELECTION_H