|
Shinya Kitaoka |
810553 |
#pragma once
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef PLASTICTOOL_H
|
|
Toshihiro Shimizu |
890ddd |
#define PLASTICTOOL_H
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TnzCore includes
|
|
Toshihiro Shimizu |
890ddd |
#include "tproperty.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tmeshimage.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TnzBase includes
|
|
Toshihiro Shimizu |
890ddd |
#include "tparamchange.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tdoubleparamrelayproperty.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TnzExt includes
|
|
Toshihiro Shimizu |
890ddd |
#include "ext/plasticskeleton.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "ext/plasticskeletondeformation.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "ext/plasticvisualsettings.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TnzQt includes
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/plasticvertexselection.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TnzTools includes
|
|
Toshihiro Shimizu |
890ddd |
#include "tools/tool.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tools/cursors.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tools/tooloptions.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// STD includes
|
|
Toshihiro Shimizu |
890ddd |
#include <memory></memory>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// tcg includes
|
|
Toshihiro Shimizu |
890ddd |
#include "tcg/tcg_base.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tcg/tcg_controlled_access.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Qt includes
|
|
Toshihiro Shimizu |
890ddd |
#include <qobject></qobject>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//****************************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// Metric defines
|
|
Toshihiro Shimizu |
890ddd |
//****************************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Skeleton primitives
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
#define HIGHLIGHT_DISTANCE 8 // Pixels distance to highlight
|
|
Shinya Kitaoka |
120a6e |
#define HANDLE_SIZE 4 // Size of vertex handles
|
|
Shinya Kitaoka |
120a6e |
#define HIGHLIGHTED_HANDLE_SIZE HIGHLIGHT_DISTANCE // Size of handle highlights
|
|
Shinya Kitaoka |
120a6e |
#define SELECTED_HANDLE_SIZE \
|
|
Shinya Kitaoka |
120a6e |
HIGHLIGHTED_HANDLE_SIZE // Size of handle selections
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Mesh primitives
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#define MESH_HIGHLIGHT_DISTANCE 8
|
|
Toshihiro Shimizu |
890ddd |
#define MESH_HIGHLIGHTED_HANDLE_SIZE 4
|
|
Toshihiro Shimizu |
890ddd |
#define MESH_SELECTED_HANDLE_SIZE 2
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//****************************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// PlasticTool declaration
|
|
Toshihiro Shimizu |
890ddd |
//****************************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
d1f6c4 |
class PlasticTool final : public QObject,
|
|
Shinya Kitaoka |
d1f6c4 |
public TTool,
|
|
Shinya Kitaoka |
d1f6c4 |
public TParamObserver,
|
|
Shinya Kitaoka |
d1f6c4 |
public TSelection::View {
|
|
Shinya Kitaoka |
120a6e |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
friend class PlasticToolOptionsBox;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
class TemporaryActivation {
|
|
Shinya Kitaoka |
120a6e |
bool m_activate;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
public:
|
|
Shinya Kitaoka |
120a6e |
TemporaryActivation(int row, int col);
|
|
Shinya Kitaoka |
120a6e |
~TemporaryActivation();
|
|
Shinya Kitaoka |
120a6e |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
d1f6c4 |
struct MeshIndex final : public tcg::safe_bool<meshindex> {</meshindex>
|
|
Shinya Kitaoka |
120a6e |
int m_meshIdx, //!< Mesh index in a TMeshImage
|
|
Shinya Kitaoka |
120a6e |
m_idx; //!< Index in the referenced mesh
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
explicit MeshIndex(int meshIdx = -1, int idx = -1)
|
|
Shinya Kitaoka |
120a6e |
: m_meshIdx(meshIdx), m_idx(idx) {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
bool operator_bool() const { return (m_meshIdx >= 0) && (m_idx >= 0); }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
bool operator<(const MeshIndex &other) const {
|
|
Shinya Kitaoka |
120a6e |
return (m_meshIdx == other.m_meshIdx) ? (m_idx < other.m_idx)
|
|
Shinya Kitaoka |
120a6e |
: (m_meshIdx < other.m_meshIdx);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
typedef MultipleSelection<meshindex> MeshSelection;</meshindex>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Shinya Kitaoka |
120a6e |
PlasticSkeletonDeformationP m_sd; //!< Current column's skeleton deformation
|
|
Shinya Kitaoka |
120a6e |
int m_skelId; //!< Current m_sd's skeleton id
|
|
Shinya Kitaoka |
120a6e |
tcg::invalidable<plasticskeleton></plasticskeleton>
|
|
Shinya Kitaoka |
120a6e |
m_deformedSkeleton; //!< The interactively-deformed \a animation-mode
|
|
Shinya Kitaoka |
38fd86 |
//! skeleton
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TMeshImageP m_mi; //!< Current mesh image
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// Property-related vars (ie, tool options)
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TPropertyGroup
|
|
Shinya Kitaoka |
120a6e |
*m_propGroup; //!< Tool properties groups (needed for toolbar-building)
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TEnumProperty m_mode; //!< Editing mode (BUILD, ANIMATE, etc..)
|
|
Shinya Kitaoka |
120a6e |
TStringProperty m_vertexName; //!< Vertex name property
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TBoolProperty m_interpolate; //!< Strict vertex interpolation property
|
|
Shinya Kitaoka |
120a6e |
TBoolProperty m_snapToMesh; //!< Snap to Mesh vertexes during skeleton build
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TDoubleProperty m_thickness; //!< Brush radius, from 1 to 100
|
|
Shinya Kitaoka |
120a6e |
TEnumProperty
|
|
Shinya Kitaoka |
120a6e |
m_rigidValue; //!< Rigidity drawing value (ie draw rigidity/flexibility)
|
|
Shinya Kitaoka |
120a6e |
//!< put a keyframe at current frame
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TBoolProperty
|
|
Shinya Kitaoka |
120a6e |
m_globalKey; //!< Whether animating a vertex will cause EVERY vertex to
|
|
Shinya Kitaoka |
120a6e |
TBoolProperty
|
|
Shinya Kitaoka |
120a6e |
m_keepDistance; //!< Whether animation editing can alter vertex distances
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TStringProperty m_minAngle,
|
|
Shinya Kitaoka |
120a6e |
m_maxAngle; //!< Minimum and maximum angle values allowed
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TPropertyGroup m_relayGroup; //!< Group for each vertex parameter relay
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TDoubleParamRelayProperty
|
|
Shinya Kitaoka |
120a6e |
m_distanceRelay; //!< Relay property for vertex distance
|
|
Shinya Kitaoka |
120a6e |
TDoubleParamRelayProperty m_angleRelay; //!< Relay property for vertex angle
|
|
Shinya Kitaoka |
120a6e |
TDoubleParamRelayProperty m_soRelay; //!< Relay property for vertex so
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TDoubleParamRelayProperty
|
|
Shinya Kitaoka |
120a6e |
m_skelIdRelay; //!< Relay property for m_sd's skeleton id
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// Mouse-related vars
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TPointD m_pos; //!< Last known mouse position
|
|
Shinya Kitaoka |
120a6e |
TPointD m_pressedPos; //!< Last mouse press position
|
|
Shinya Kitaoka |
120a6e |
bool m_dragged; //!< Whether dragging occurred between a press/release
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
std::vector<tpointd></tpointd>
|
|
Shinya Kitaoka |
120a6e |
m_pressedVxsPos; //!< Position of selected vertices at mouse press
|
|
Shinya Kitaoka |
120a6e |
SkDKey m_pressedSkDF; //!< Skeleton deformation keyframes at mouse press
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// Selection/Highlighting-related vars
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
int m_svHigh, //!< Highlighted skeleton vertexes
|
|
Shinya Kitaoka |
120a6e |
m_seHigh; //!< Highlighted skeleton edges
|
|
Shinya Kitaoka |
120a6e |
PlasticVertexSelection m_svSel; //!< Selected skeleton vertexes
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
MeshIndex m_mvHigh, //!< Highlighted mesh vertexes
|
|
Shinya Kitaoka |
120a6e |
m_meHigh; //!< Highlighted mesh edges
|
|
Shinya Kitaoka |
120a6e |
MeshSelection m_mvSel, //!< Selected mesh vertexes
|
|
Shinya Kitaoka |
120a6e |
m_meSel; //!< Selected mesh edges
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// Drawing-related vars
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
PlasticVisualSettings m_pvs; //!< Visual options for plastic painting
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// Editing-related vars
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
2a7129 |
std::unique_ptr<tcg::polymorphic> m_rigidityPainter; //!< Delegate class to</tcg::polymorphic>
|
|
Shinya Kitaoka |
2a7129 |
//! deal with (undoable)
|
|
Shinya Kitaoka |
38fd86 |
//! rigidity painting
|
|
Shinya Kitaoka |
120a6e |
bool m_showSkeletonOS; //!< Whether onion-skinned skeletons must be shown
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// Deformation-related vars
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
bool m_recompileOnMouseRelease; //!< Whether skeleton recompilation should
|
|
Shinya Kitaoka |
38fd86 |
//! happen on mouse release
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
enum Modes {
|
|
Shinya Kitaoka |
120a6e |
MESH_IDX = 0,
|
|
Shinya Kitaoka |
120a6e |
RIGIDITY_IDX,
|
|
Shinya Kitaoka |
120a6e |
BUILD_IDX,
|
|
Shinya Kitaoka |
120a6e |
ANIMATE_IDX,
|
|
Shinya Kitaoka |
120a6e |
MODES_COUNT
|
|
Shinya Kitaoka |
120a6e |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
PlasticTool();
|
|
Shinya Kitaoka |
120a6e |
~PlasticTool();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
ToolType getToolType() const override;
|
|
Shinya Kitaoka |
473e70 |
int getCursorId() const override { return ToolCursor::SplineEditorCursor; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
ToolOptionsBox *createOptionsBox() override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
TPropertyGroup *getProperties(int idx) override { return &m_propGroup[idx]; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void updateTranslation() override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void onSetViewer() override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void onActivate() override;
|
|
Shinya Kitaoka |
473e70 |
void onDeactivate() override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void onEnter() override;
|
|
Shinya Kitaoka |
473e70 |
void onLeave() override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void addContextMenuItems(QMenu *menu) override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void reset() override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
bool onPropertyChanged(std::string propertyName) override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
// Methods reimplemented in each interaction mode
|
|
Shinya Kitaoka |
473e70 |
void mouseMove(const TPointD &pos, const TMouseEvent &me) override;
|
|
Shinya Kitaoka |
473e70 |
void leftButtonDown(const TPointD &pos, const TMouseEvent &me) override;
|
|
Shinya Kitaoka |
473e70 |
void leftButtonDrag(const TPointD &pos, const TMouseEvent &me) override;
|
|
Shinya Kitaoka |
473e70 |
void leftButtonUp(const TPointD &pos, const TMouseEvent &me) override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void draw() override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
// Skeleton methods
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void setSkeletonSelection(const PlasticVertexSelection &vSel);
|
|
Shinya Kitaoka |
120a6e |
void toggleSkeletonSelection(const PlasticVertexSelection &vSel);
|
|
Shinya Kitaoka |
120a6e |
void clearSkeletonSelections();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
const PlasticVertexSelection &skeletonVertexSelection() const {
|
|
Shinya Kitaoka |
120a6e |
return m_svSel;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
PlasticVertexSelection branchSelection(int vIdx) const;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void moveVertex_build(const std::vector<tpointd> &originalVxsPos,</tpointd>
|
|
Shinya Kitaoka |
120a6e |
const TPointD &posShift);
|
|
Shinya Kitaoka |
120a6e |
void addVertex(const PlasticSkeletonVertex &vx);
|
|
Shinya Kitaoka |
120a6e |
void insertVertex(const PlasticSkeletonVertex &vx, int e);
|
|
Shinya Kitaoka |
120a6e |
void insertVertex(const PlasticSkeletonVertex &vx, int parent,
|
|
Shinya Kitaoka |
120a6e |
const std::vector<int> &children);</int>
|
|
Shinya Kitaoka |
120a6e |
void removeVertex();
|
|
Shinya Kitaoka |
120a6e |
void setVertexName(QString &name);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
int addSkeleton(const PlasticSkeletonP &skeleton);
|
|
Shinya Kitaoka |
120a6e |
void addSkeleton(int skelId, const PlasticSkeletonP &skeleton);
|
|
Shinya Kitaoka |
120a6e |
void removeSkeleton(int skelId);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
PlasticSkeletonP skeleton() const;
|
|
Shinya Kitaoka |
120a6e |
void touchSkeleton();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
PlasticSkeletonDeformationP deformation() const { return m_sd; }
|
|
Shinya Kitaoka |
120a6e |
void touchDeformation();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void storeDeformation(); //!< Stores deformation of current column (copying
|
|
Shinya Kitaoka |
38fd86 |
//! its reference)
|
|
Shinya Kitaoka |
120a6e |
void storeSkeletonId(); //!< Stores current skeleton id associated to current
|
|
Shinya Kitaoka |
38fd86 |
//! deformation
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void onChange(); //!< Updates the tool after a deformation parameter change.
|
|
Shinya Kitaoka |
120a6e |
//!< It can be used to refresh the tool in ANIMATION mode.
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
// Mesh methods
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
const MeshSelection &meshVertexesSelection() const { return m_mvSel; }
|
|
Shinya Kitaoka |
120a6e |
const MeshSelection &meshEdgesSelection() const { return m_meSel; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void setMeshVertexesSelection(const MeshSelection &vSel);
|
|
Shinya Kitaoka |
120a6e |
void toggleMeshVertexesSelection(const MeshSelection &vSel);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void setMeshEdgesSelection(const MeshSelection &eSel);
|
|
Shinya Kitaoka |
120a6e |
void toggleMeshEdgesSelection(const MeshSelection &eSel);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void clearMeshSelections();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void storeMeshImage();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void moveVertex_mesh(const std::vector<tpointd> &originalVxsPos,</tpointd>
|
|
Shinya Kitaoka |
120a6e |
const TPointD &posShift);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
// Actions with associated undo
|
|
Shinya Kitaoka |
120a6e |
int addSkeleton_undo(const PlasticSkeletonP &skeleton);
|
|
Shinya Kitaoka |
120a6e |
void addSkeleton_undo(int skelId, const PlasticSkeletonP &skeleton);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void removeSkeleton_undo(int skelId);
|
|
Shinya Kitaoka |
120a6e |
void removeSkeleton_withKeyframes_undo(int skelId);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void editSkelId_undo(int skelId);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public slots:
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void swapEdge_mesh_undo();
|
|
Shinya Kitaoka |
120a6e |
void collapseEdge_mesh_undo();
|
|
Shinya Kitaoka |
120a6e |
void splitEdge_mesh_undo();
|
|
Shinya Kitaoka |
120a6e |
void cutEdges_mesh_undo();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void deleteSelectedVertex_undo();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void setKey_undo();
|
|
Shinya Kitaoka |
120a6e |
void setGlobalKey_undo();
|
|
Shinya Kitaoka |
120a6e |
void setRestKey_undo();
|
|
Shinya Kitaoka |
120a6e |
void setGlobalRestKey_undo();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void copySkeleton();
|
|
Shinya Kitaoka |
120a6e |
void pasteSkeleton_undo();
|
|
Shinya Kitaoka |
120a6e |
void copyDeformation();
|
|
Shinya Kitaoka |
120a6e |
void pasteDeformation_undo();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
signals: // privates
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void skelIdsListChanged();
|
|
Shinya Kitaoka |
120a6e |
void skelIdChanged();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Shinya Kitaoka |
120a6e |
void mouseMove_mesh(const TPointD &pos, const TMouseEvent &me);
|
|
Shinya Kitaoka |
120a6e |
void leftButtonDown_mesh(const TPointD &pos, const TMouseEvent &me);
|
|
Shinya Kitaoka |
120a6e |
void leftButtonDrag_mesh(const TPointD &pos, const TMouseEvent &me);
|
|
Shinya Kitaoka |
120a6e |
void leftButtonUp_mesh(const TPointD &pos, const TMouseEvent &me);
|
|
Shinya Kitaoka |
120a6e |
void addContextMenuActions_mesh(QMenu *menu);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void mouseMove_build(const TPointD &pos, const TMouseEvent &me);
|
|
Shinya Kitaoka |
120a6e |
void leftButtonDown_build(const TPointD &pos, const TMouseEvent &me);
|
|
Shinya Kitaoka |
120a6e |
void leftButtonDrag_build(const TPointD &pos, const TMouseEvent &me);
|
|
Shinya Kitaoka |
120a6e |
void leftButtonUp_build(const TPointD &pos, const TMouseEvent &me);
|
|
Shinya Kitaoka |
120a6e |
void addContextMenuActions_build(QMenu *menu);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void mouseMove_rigidity(const TPointD &pos, const TMouseEvent &me);
|
|
Shinya Kitaoka |
120a6e |
void leftButtonDown_rigidity(const TPointD &pos, const TMouseEvent &me);
|
|
Shinya Kitaoka |
120a6e |
void leftButtonDrag_rigidity(const TPointD &pos, const TMouseEvent &me);
|
|
Shinya Kitaoka |
120a6e |
void leftButtonUp_rigidity(const TPointD &pos, const TMouseEvent &me);
|
|
Shinya Kitaoka |
120a6e |
void addContextMenuActions_rigidity(QMenu *menu);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void mouseMove_animate(const TPointD &pos, const TMouseEvent &me);
|
|
Shinya Kitaoka |
120a6e |
void leftButtonDown_animate(const TPointD &pos, const TMouseEvent &me);
|
|
Shinya Kitaoka |
120a6e |
void leftButtonDrag_animate(const TPointD &pos, const TMouseEvent &me);
|
|
Shinya Kitaoka |
120a6e |
void leftButtonUp_animate(const TPointD &pos, const TMouseEvent &me);
|
|
Shinya Kitaoka |
120a6e |
void addContextMenuActions_animate(QMenu *menu);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void draw_mesh();
|
|
Shinya Kitaoka |
120a6e |
void draw_build();
|
|
Shinya Kitaoka |
120a6e |
void draw_rigidity();
|
|
Shinya Kitaoka |
120a6e |
void draw_animate();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Shinya Kitaoka |
120a6e |
// Skeleton methods
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
PlasticSkeleton &deformedSkeleton();
|
|
Shinya Kitaoka |
120a6e |
void updateDeformedSkeleton(PlasticSkeleton &deformedSkeleton);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// Keyframe methods
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void keyFunc_undo(void (PlasticTool::*keyFunc)());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void setKey();
|
|
Shinya Kitaoka |
120a6e |
void setGlobalKey();
|
|
Shinya Kitaoka |
120a6e |
void setRestKey();
|
|
Shinya Kitaoka |
120a6e |
void setGlobalRestKey();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// Rigidity methods
|
|
Shinya Kitaoka |
2a7129 |
static std::unique_ptr<tcg::polymorphic> createRigidityPainter();</tcg::polymorphic>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// Drawing methods
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void drawSkeleton(const PlasticSkeleton &skel, double pixelSize,
|
|
Shinya Kitaoka |
120a6e |
UCHAR alpha = 255);
|
|
Shinya Kitaoka |
120a6e |
void drawOnionSkinSkeletons_build(double pixelSize);
|
|
Shinya Kitaoka |
120a6e |
void drawOnionSkinSkeletons_animate(double pixelSize);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void drawHighlights(const SkDP &sd, const PlasticSkeleton *skel,
|
|
Shinya Kitaoka |
120a6e |
double pixelSize);
|
|
Shinya Kitaoka |
120a6e |
void drawSelections(const SkDP &sd, const PlasticSkeleton &skel,
|
|
Shinya Kitaoka |
120a6e |
double pixelSize);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void drawAngleLimits(const SkDP &sd, int skeId, int v, double pixelSize);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// Selection methods
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void setMeshSelection(MeshSelection &target, const MeshSelection &newSel);
|
|
Shinya Kitaoka |
120a6e |
void toggleMeshSelection(MeshSelection &target,
|
|
Shinya Kitaoka |
120a6e |
const MeshSelection &addedSel);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void onSelectionChanged() override;
|
|
Shinya Kitaoka |
473e70 |
void enableCommands() override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// Parameter Observation methods
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void onChange(const TParamChange &) override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private slots:
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void onFrameSwitched() override;
|
|
Shinya Kitaoka |
120a6e |
void onColumnSwitched();
|
|
Shinya Kitaoka |
120a6e |
void onXsheetChanged();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void onShowMeshToggled(bool on);
|
|
Shinya Kitaoka |
120a6e |
void onShowSOToggled(bool on);
|
|
Shinya Kitaoka |
120a6e |
void onShowRigidityToggled(bool on);
|
|
Shinya Kitaoka |
120a6e |
void onShowSkelOSToggled(bool on);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//****************************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// PlasticToolOptionsBox declaration
|
|
Toshihiro Shimizu |
890ddd |
//****************************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
d1f6c4 |
class PlasticToolOptionsBox final : public GenericToolOptionsBox,
|
|
Shinya Kitaoka |
d1f6c4 |
public TProperty::Listener {
|
|
Shinya Kitaoka |
120a6e |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
PlasticToolOptionsBox(QWidget *parent, TTool *tool,
|
|
Shinya Kitaoka |
120a6e |
TPaletteHandle *pltHandle);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Shinya Kitaoka |
120a6e |
class SkelIdsComboBox;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Shinya Kitaoka |
120a6e |
TTool *m_tool;
|
|
Shinya Kitaoka |
120a6e |
GenericToolOptionsBox **m_subToolbars;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
SkelIdsComboBox *m_skelIdComboBox;
|
|
Shinya Kitaoka |
120a6e |
QPushButton *m_addSkelButton, *m_removeSkelButton;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Shinya Kitaoka |
473e70 |
void showEvent(QShowEvent *se) override;
|
|
Shinya Kitaoka |
473e70 |
void hideEvent(QHideEvent *he) override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void onPropertyChanged() override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private slots:
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void onSkelIdsListChanged();
|
|
Shinya Kitaoka |
120a6e |
void onSkelIdChanged();
|
|
Shinya Kitaoka |
120a6e |
void onSkelIdEdited();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void onAddSkeleton();
|
|
Shinya Kitaoka |
120a6e |
void onRemoveSkeleton();
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//****************************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// PlasticTool local functions
|
|
Toshihiro Shimizu |
890ddd |
//****************************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
namespace PlasticToolLocals {
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
extern PlasticTool l_plasticTool; //!< Tool instance.
|
|
Shinya Kitaoka |
120a6e |
extern bool l_suspendParamsObservation; //!< Used to join multiple param change
|
|
Shinya Kitaoka |
38fd86 |
//! notifications.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Generic functions
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TPointD projection(
|
|
Shinya Kitaoka |
120a6e |
const PlasticSkeleton &skeleton, int e,
|
|
Shinya Kitaoka |
120a6e |
const TPointD &pos); //!< Projects specified position an a skeleton edge.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Global getters
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
double frame(); //!< Returns current global xsheet frame.
|
|
Shinya Kitaoka |
120a6e |
int row(); //!< Returns current global xsheet row.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
int column(); //!< Returns current global xsheet column index.
|
|
Shinya Kitaoka |
120a6e |
TXshColumn *xshColumn(); //!< Returns current xsheet column object.
|
|
Shinya Kitaoka |
120a6e |
TStageObject *stageObject(); //!< Returns current stage object.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
const TXshCell &xshCell(); //!< Returns current xsheet cell.
|
|
Shinya Kitaoka |
120a6e |
void setCell(
|
|
Shinya Kitaoka |
120a6e |
int row,
|
|
Shinya Kitaoka |
120a6e |
int col); //!< Moves current xsheet cell to the specified position.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
int skeletonId(); //!< Returns current skeleton id.
|
|
Shinya Kitaoka |
120a6e |
double sdFrame(); //!< Returns current stage object's parameters time
|
|
Shinya Kitaoka |
120a6e |
//! (ie the frame value to be used with function editor curves,
|
|
Shinya Kitaoka |
120a6e |
//! which takes cyclicity into consideration).
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Keyframe functions
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void setKeyframe(
|
|
Shinya Kitaoka |
120a6e |
TDoubleParamP ¶m,
|
|
Shinya Kitaoka |
120a6e |
double frame); //!< Sets a keyframe to the specified parameter curve.
|
|
Shinya Kitaoka |
120a6e |
void setKeyframe(
|
|
Shinya Kitaoka |
120a6e |
SkVD *vd,
|
|
Shinya Kitaoka |
120a6e |
double frame); //!< Sets a keyframe to the specified vertex deformation.
|
|
Shinya Kitaoka |
120a6e |
void setKeyframe(
|
|
Shinya Kitaoka |
120a6e |
const PlasticSkeletonDeformationP &sd,
|
|
Shinya Kitaoka |
120a6e |
double frame); //!< Sets a keyframe to an entire skeleton deformation.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void invalidateXsheet(); //!< Refreshes xsheet content.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Draw functions
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void drawSquare(const TPointD &pos,
|
|
Shinya Kitaoka |
120a6e |
double radius); //!< Draws the outline of a square
|
|
Shinya Kitaoka |
120a6e |
void drawFullSquare(const TPointD &pos,
|
|
Shinya Kitaoka |
120a6e |
double radius); //!< Draws a filled square
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Mesh functions
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
std::pair<double, plastictool::meshindex=""> closestVertex(const TMeshImage &mi,</double,>
|
|
Shinya Kitaoka |
120a6e |
const TPointD &pos);
|
|
Shinya Kitaoka |
120a6e |
std::pair<double, plastictool::meshindex=""> closestEdge(const TMeshImage &mi,</double,>
|
|
Shinya Kitaoka |
120a6e |
const TPointD &pos);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
} // namespace PlasticToolLocals
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
#endif // PLASTICTOOL_H
|