Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polygon: Fix misalignment of gizmos #2088

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/node/distort/transform/transformdistortnode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ QTransform TransformDistortNode::GizmoTransformation(const NodeValueRow &row, co
{
if (TexturePtr texture = row[kTextureInput].toTexture()) {
//auto m = GenerateMatrix(row, false, false, false, row[kParentInput].toMatrix());
auto m = GenerateMatrix(row, false, false, false, QMatrix4x4());
auto m = GenerateMatrix(row, false, false, false, QMatrix4x4(), true);
return GenerateAutoScaledMatrix(m, row, globals, texture->params()).toTransform();
}
return super::GizmoTransformation(row, globals);
Expand Down
4 changes: 3 additions & 1 deletion app/node/generator/matrix/matrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ void MatrixGenerator::Value(const NodeValueRow &value, const NodeGlobals &global
table->Push(NodeValue::kMatrix, mat, this);
}

QMatrix4x4 MatrixGenerator::GenerateMatrix(const NodeValueRow &value, bool ignore_anchor, bool ignore_position, bool ignore_scale, const QMatrix4x4 &mat) const
QMatrix4x4 MatrixGenerator::GenerateMatrix(const NodeValueRow &value, bool ignore_anchor, bool ignore_position, bool ignore_scale, const QMatrix4x4 &mat, bool is_gizmo) const
{
QVector2D anchor;
QVector2D position;
Expand All @@ -110,6 +110,8 @@ QMatrix4x4 MatrixGenerator::GenerateMatrix(const NodeValueRow &value, bool ignor

if (!ignore_position) {
position = value[kPositionInput].toVec2();
if (is_gizmo)
position /= 2;
}

return GenerateMatrix(position,
Expand Down
2 changes: 1 addition & 1 deletion app/node/generator/matrix/matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class MatrixGenerator : public Node
static const QString kAnchorInput;

protected:
QMatrix4x4 GenerateMatrix(const NodeValueRow &value, bool ignore_anchor, bool ignore_position, bool ignore_scale, const QMatrix4x4 &mat) const;
QMatrix4x4 GenerateMatrix(const NodeValueRow &value, bool ignore_anchor, bool ignore_position, bool ignore_scale, const QMatrix4x4 &mat, bool is_gizmo = false) const;
static QMatrix4x4 GenerateMatrix(const QVector2D &pos,
const float &rot,
const QVector2D &scale,
Expand Down
1 change: 1 addition & 0 deletions app/node/generator/polygon/polygon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ void PolygonGenerator::UpdateGizmoPositions(const NodeValueRow &row, const NodeG

QPointF half_res = res.toPointF()/2;


auto points = row[kPointsInput].toArray();

int current_pos_sz = gizmo_position_handles_.size();
Expand Down
1 change: 0 additions & 1 deletion app/widget/viewer/viewerdisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,6 @@ void ViewerDisplayWidget::OnPaint()
QPainter p(paint_device());

GenerateGizmoTransforms();

p.setWorldTransform(gizmo_last_draw_transform_);

gizmos_->UpdateGizmoPositions(gizmo_db_, NodeGlobals(gizmo_params_, gizmo_audio_params_, gizmo_draw_time_, LoopMode::kLoopModeOff));
Expand Down