OpenToonz - An open-source full-featured 2D animation creation software
C
fix-rotate-at-camera-center-option
Abel Youf685e1f9eeb3
diff --git a/toonz/sources/tnztools/tooloptions.cpp b/toonz/sources/tnztools/tooloptions.cppindex 74d18399c..09f7dfe91 100644--- a/toonz/sources/tnztools/tooloptions.cpp+++ b/toonz/sources/tnztools/tooloptions.cpp@@ -2826,6 +2826,12 @@ RotateToolOptionsBox::RotateToolOptionsBox(QWidget *parent, TTool *tool,setFrameStyle(QFrame::StyledPanel);setFixedHeight(26);+ TPropertyGroup* props = tool->getProperties(0);+ assert(props->getPropertyCount() > 0);++ ToolOptionControlBuilder builder(this, tool, pltHandle, toolHandle);+ if (tool && tool->getProperties(0)) tool->getProperties(0)->accept(builder);+QAction *resetRotationAction =CommandManager::instance()->getAction(VB_RotateReset);diff --git a/toonz/sources/tnztools/viewtools.cpp b/toonz/sources/tnztools/viewtools.cppindex 3c8be11ec..03616d532 100644--- a/toonz/sources/tnztools/viewtools.cpp+++ b/toonz/sources/tnztools/viewtools.cpp@@ -3,11 +3,14 @@#include "tools/cursors.h"#include "tgeometry.h"+#include "tenv.h"#include <math.h>#include "tgl.h"+TEnv::IntVar RotateOnCameraCenter("RotateOnCameraCenter", 0);+namespace {//=============================================================================@@ -137,6 +140,7 @@ RotateTool::RotateTool(std::string name), m_cameraCentered("Rotate On Camera Center", false), m_angle(0) {bind(TTool::AllTargets);+ m_cameraCentered.setId("RotateOnCamCenter");m_prop.bind(m_cameraCentered);}@@ -205,4 +209,17 @@ void RotateTool::draw() {int RotateTool::getCursorId() const { return ToolCursor::RotateCursor; }+void RotateTool::onActivate() {+ if (m_firstTime) {+ m_cameraCentered.setValue(RotateOnCameraCenter != 0);+ m_firstTime = false;+ }+}++bool RotateTool::onPropertyChanged(std::string propertyName, bool addToUndo) {+ if (propertyName == "Rotate On Camera Center")+ RotateOnCameraCenter = m_cameraCentered.getValue() ? 1 : 0;+ return true;+}+RotateTool rotateTool("T_Rotate"), rotateViewTool("T_RotateView");\ No newline at end of filediff --git a/toonz/sources/tnztools/viewtools.h b/toonz/sources/tnztools/viewtools.hindex 75144e793..ef411a310 100644--- a/toonz/sources/tnztools/viewtools.h+++ b/toonz/sources/tnztools/viewtools.h@@ -22,6 +22,7 @@ class RotateTool final : public QObject, public TTool {TPointD m_oldMousePos;TBoolProperty m_cameraCentered;TPropertyGroup m_prop;+ bool m_firstTime = true;public:RotateTool(std::string name);@@ -37,6 +38,9 @@ public:int getCursorId() const override;+ void onActivate() override;+ bool onPropertyChanged(std::string propertyName, bool addToUndo) override;+void updateTranslation() override {m_cameraCentered.setQStringName(tr("Rotate On Camera Center"));}