Skip to content

Commit

Permalink
don't copy flags when copying texture
Browse files Browse the repository at this point in the history
  • Loading branch information
neogeographica committed May 24, 2020
1 parent 600560b commit ef8d036
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 3 deletions.
12 changes: 10 additions & 2 deletions common/src/Model/ChangeBrushFaceAttributesRequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -490,15 +490,23 @@ namespace TrenchBroom {
setAll(face.attributes());
}

void ChangeBrushFaceAttributesRequest::setAllExceptFlags(const Model::BrushFace& face) {
setAllExceptFlags(face.attributes());
}

void ChangeBrushFaceAttributesRequest::setAll(const Model::BrushFaceAttributes& attributes) {
setAllExceptFlags(attributes);
replaceSurfaceFlags(attributes.surfaceFlags());
replaceContentFlags(attributes.surfaceContents());
}

void ChangeBrushFaceAttributesRequest::setAllExceptFlags(const Model::BrushFaceAttributes& attributes) {
setTextureName(attributes.textureName());
setXOffset(attributes.xOffset());
setYOffset(attributes.yOffset());
setRotation(attributes.rotation());
setXScale(attributes.xScale());
setYScale(attributes.yScale());
replaceSurfaceFlags(attributes.surfaceFlags());
replaceContentFlags(attributes.surfaceContents());
setSurfaceValue(attributes.surfaceValue());
setColor(attributes.color());
}
Expand Down
2 changes: 2 additions & 0 deletions common/src/Model/ChangeBrushFaceAttributesRequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ namespace TrenchBroom {
void setColor(const Color& colorValue);

void setAll(const Model::BrushFace& face);
void setAllExceptFlags(const Model::BrushFace& face);
void setAll(const Model::BrushFaceAttributes& attributes);
void setAllExceptFlags(const Model::BrushFaceAttributes& attributes);

bool collateWith(ChangeBrushFaceAttributesRequest& other);
};
Expand Down
1 change: 1 addition & 0 deletions common/src/Model/MapFacade.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ namespace TrenchBroom {
virtual bool resizeBrushes(const std::vector<vm::polygon3>& faces, const vm::vec3& delta) = 0;
public: // modifying face attributes
virtual bool setFaceAttributes(const BrushFaceAttributes& attributes) = 0;
virtual bool setFaceAttributesExceptFlags(const BrushFaceAttributes& attributes) = 0;
virtual bool setFaceAttributes(const ChangeBrushFaceAttributesRequest& request) = 0;
virtual bool moveTextures(const vm::vec3f& cameraUp, const vm::vec3f& cameraRight, const vm::vec2f& delta) = 0;
virtual bool rotateTextures(float angle) = 0;
Expand Down
6 changes: 6 additions & 0 deletions common/src/View/MapDocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1370,6 +1370,12 @@ namespace TrenchBroom {
return setFaceAttributes(request);
}

bool MapDocument::setFaceAttributesExceptFlags(const Model::BrushFaceAttributes& attributes) {
Model::ChangeBrushFaceAttributesRequest request;
request.setAllExceptFlags(attributes);
return setFaceAttributes(request);
}

bool MapDocument::setFaceAttributes(const Model::ChangeBrushFaceAttributesRequest& request) {
const auto result = executeAndStore(ChangeBrushFaceAttributesCommand::command(request));
return result->success();
Expand Down
1 change: 1 addition & 0 deletions common/src/View/MapDocument.h
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ namespace TrenchBroom {
bool resizeBrushes(const std::vector<vm::polygon3>& faces, const vm::vec3& delta) override;
public:
bool setFaceAttributes(const Model::BrushFaceAttributes& attributes) override;
bool setFaceAttributesExceptFlags(const Model::BrushFaceAttributes& attributes) override;
bool setFaceAttributes(const Model::ChangeBrushFaceAttributesRequest& request) override;
bool copyTexCoordSystemFromFace(const Model::TexCoordSystemSnapshot& coordSystemSnapshot, const Model::BrushFaceAttributes& attribs, const vm::plane3& sourceFacePlane, const Model::WrapStyle wrapStyle);
bool moveTextures(const vm::vec3f& cameraUp, const vm::vec3f& cameraRight, const vm::vec2f& delta) override;
Expand Down
2 changes: 1 addition & 1 deletion common/src/View/SetBrushFaceAttributesTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ namespace TrenchBroom {
document->setFaceAttributes(request);
} else {
auto snapshot = sourceFaceHandle.face().takeTexCoordSystemSnapshot();
document->setFaceAttributes(sourceFaceHandle.face().attributes());
document->setFaceAttributesExceptFlags(sourceFaceHandle.face().attributes());
if (snapshot != nullptr) {
document->copyTexCoordSystemFromFace(*snapshot, sourceFaceHandle.face().attributes().takeSnapshot(), sourceFaceHandle.face().boundary(), style);
}
Expand Down

0 comments on commit ef8d036

Please sign in to comment.