Skip to content

Commit

Permalink
Fix unwanted extra rotations when translating rotated func_static
Browse files Browse the repository at this point in the history
When Doom3Group and Doom3GroupNode were merged, all of the methods from
Doom3Group were moved into Doom3GroupNode. Two of these methods were
revertTransform() and freezeTransform(), which had the same name as virtuals on
the Transformable interface and therefore became unintentional overrides,
obliterating important functionality from Transformable which we still need in
Doom3GroupNode.

The fact that these methods triggered a "missing override keyword" warning
ought to have been an important red flag, but unfortunately I just mechanically
added the keyword without considering if these new methods actually *should*
have been overriding anything.
  • Loading branch information
Matthew Mott committed Nov 30, 2021
1 parent 79c1f77 commit 54dc20e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
12 changes: 6 additions & 6 deletions radiantcore/entity/doom3group/Doom3GroupNode.cpp
Expand Up @@ -372,7 +372,7 @@ void Doom3GroupNode::_onTransformationChanged()
child.revertTransform();
});

revertTransform();
revertTransformInternal();

evaluateTransform();

Expand All @@ -382,7 +382,7 @@ void Doom3GroupNode::_onTransformationChanged()
else
{
// It's a model
revertTransform();
revertTransformInternal();
evaluateTransform();
updateTransform();
}
Expand All @@ -393,9 +393,9 @@ void Doom3GroupNode::_onTransformationChanged()

void Doom3GroupNode::_applyTransformation()
{
revertTransform();
revertTransformInternal();
evaluateTransform();
freezeTransform();
freezeTransformInternal();

if (!isModel())
{
Expand Down Expand Up @@ -527,7 +527,7 @@ void Doom3GroupNode::snapto(float snap)
m_originKey.write(_spawnArgs);
}

void Doom3GroupNode::revertTransform()
void Doom3GroupNode::revertTransformInternal()
{
m_origin = m_originKey.get();

Expand All @@ -544,7 +544,7 @@ void Doom3GroupNode::revertTransform()
m_curveCatmullRom.revertTransform();
}

void Doom3GroupNode::freezeTransform()
void Doom3GroupNode::freezeTransformInternal()
{
m_originKey.set(m_origin);
m_originKey.write(_spawnArgs);
Expand Down
6 changes: 2 additions & 4 deletions radiantcore/entity/doom3group/Doom3GroupNode.h
Expand Up @@ -175,8 +175,8 @@ class Doom3GroupNode :
void translate(const Vector3& translation);
void rotate(const Quaternion& rotation);
void scale(const Vector3& scale);
void revertTransform() override;
void freezeTransform() override;
void revertTransformInternal();
void freezeTransformInternal();

// Translates the origin only (without the children)
void translateOrigin(const Vector3& translation);
Expand All @@ -188,8 +188,6 @@ class Doom3GroupNode :
// Returns TRUE if this D3Group is a model
bool isModel() const;

void setTransformChanged(Callback& callback);

public:

void nameChanged(const std::string& value);
Expand Down

0 comments on commit 54dc20e

Please sign in to comment.