From ec2ff2a9b0150a887dc80b91754701bf31806e27 Mon Sep 17 00:00:00 2001 From: Nelsson Huotari Date: Thu, 26 Mar 2020 14:47:40 +0200 Subject: [PATCH] Fix if oneliners --- apps/opencs/view/render/brushdraw.cpp | 9 ++++++--- apps/opencs/view/render/terrainshapemode.cpp | 6 ++++-- apps/opencs/view/render/terraintexturemode.cpp | 6 ++++-- apps/opencs/view/widget/scenetooltexturebrush.cpp | 12 ++++++++---- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/apps/opencs/view/render/brushdraw.cpp b/apps/opencs/view/render/brushdraw.cpp index d33ef3367..478ff7a9d 100644 --- a/apps/opencs/view/render/brushdraw.cpp +++ b/apps/opencs/view/render/brushdraw.cpp @@ -20,7 +20,8 @@ CSVRender::BrushDraw::BrushDraw(osg::ref_ptr parentNode, bool textur mGeometry = new osg::Geometry(); mBrushDrawNode->addChild(mGeometry); mParentNode->addChild(mBrushDrawNode); - if (mTextureMode) mLandSizeFactor = ESM::Land::REAL_SIZE / ESM::Land::LAND_TEXTURE_SIZE; + if (mTextureMode) + mLandSizeFactor = ESM::Land::REAL_SIZE / ESM::Land::LAND_TEXTURE_SIZE; else mLandSizeFactor = ESM::Land::REAL_SIZE / ESM::Land::LAND_SIZE; } @@ -254,7 +255,8 @@ void CSVRender::BrushDraw::buildCustomGeometry(const float& radius, const osg::V void CSVRender::BrushDraw::update(osg::Vec3d point, int brushSize, CSVWidget::BrushShape toolShape) { - if (mBrushDrawNode->containsNode(mGeometry)) mBrushDrawNode->removeChild(mGeometry); + if (mBrushDrawNode->containsNode(mGeometry)) + mBrushDrawNode->removeChild(mGeometry); mBrushDrawNode->setNodeMask (SceneUtil::Mask_GUI); float radius = (mLandSizeFactor * brushSize) / 2; osg::Vec3d snapToGridPoint = point; @@ -301,5 +303,6 @@ void CSVRender::BrushDraw::update(osg::Vec3d point, int brushSize, CSVWidget::Br void CSVRender::BrushDraw::hide() { - if (mBrushDrawNode->containsNode(mGeometry)) mBrushDrawNode->removeChild(mGeometry); + if (mBrushDrawNode->containsNode(mGeometry)) + mBrushDrawNode->removeChild(mGeometry); } diff --git a/apps/opencs/view/render/terrainshapemode.cpp b/apps/opencs/view/render/terrainshapemode.cpp index cf380e791..ae8e6e89b 100644 --- a/apps/opencs/view/render/terrainshapemode.cpp +++ b/apps/opencs/view/render/terrainshapemode.cpp @@ -1398,8 +1398,10 @@ void CSVRender::TerrainShapeMode::dragMoveEvent (QDragMoveEvent *event) void CSVRender::TerrainShapeMode::mouseMoveEvent (QMouseEvent *event) { WorldspaceHitResult hit = getWorldspaceWidget().mousePick(event->pos(), getInteractionMask()); - if (hit.hit && mBrushDraw && !(mShapeEditTool == ShapeEditTool_Drag && mIsEditing)) mBrushDraw->update(hit.worldPos, mBrushSize, mBrushShape); - if (!hit.hit && mBrushDraw && !(mShapeEditTool == ShapeEditTool_Drag && mIsEditing)) mBrushDraw->hide(); + if (hit.hit && mBrushDraw && !(mShapeEditTool == ShapeEditTool_Drag && mIsEditing)) + mBrushDraw->update(hit.worldPos, mBrushSize, mBrushShape); + if (!hit.hit && mBrushDraw && !(mShapeEditTool == ShapeEditTool_Drag && mIsEditing)) + mBrushDraw->hide(); } void CSVRender::TerrainShapeMode::setBrushSize(int brushSize) diff --git a/apps/opencs/view/render/terraintexturemode.cpp b/apps/opencs/view/render/terraintexturemode.cpp index 386ff2f90..04189ce8c 100644 --- a/apps/opencs/view/render/terraintexturemode.cpp +++ b/apps/opencs/view/render/terraintexturemode.cpp @@ -724,8 +724,10 @@ void CSVRender::TerrainTextureMode::dragMoveEvent (QDragMoveEvent *event) void CSVRender::TerrainTextureMode::mouseMoveEvent (QMouseEvent *event) { WorldspaceHitResult hit = getWorldspaceWidget().mousePick(event->pos(), getInteractionMask()); - if (hit.hit && mBrushDraw) mBrushDraw->update(hit.worldPos, mBrushSize, mBrushShape); - if (!hit.hit && mBrushDraw) mBrushDraw->hide(); + if (hit.hit && mBrushDraw) + mBrushDraw->update(hit.worldPos, mBrushSize, mBrushShape); + if (!hit.hit && mBrushDraw) + mBrushDraw->hide(); } diff --git a/apps/opencs/view/widget/scenetooltexturebrush.cpp b/apps/opencs/view/widget/scenetooltexturebrush.cpp index 0a1ed6683..35937f1a6 100644 --- a/apps/opencs/view/widget/scenetooltexturebrush.cpp +++ b/apps/opencs/view/widget/scenetooltexturebrush.cpp @@ -204,10 +204,14 @@ void CSVWidget::TextureBrushWindow::setBrushSize(int brushSize) void CSVWidget::TextureBrushWindow::setBrushShape() { - if(mButtonPoint->isChecked()) mBrushShape = CSVWidget::BrushShape_Point; - if(mButtonSquare->isChecked()) mBrushShape = CSVWidget::BrushShape_Square; - if(mButtonCircle->isChecked()) mBrushShape = CSVWidget::BrushShape_Circle; - if(mButtonCustom->isChecked()) mBrushShape = CSVWidget::BrushShape_Custom; + if (mButtonPoint->isChecked()) + mBrushShape = CSVWidget::BrushShape_Point; + if (mButtonSquare->isChecked()) + mBrushShape = CSVWidget::BrushShape_Square; + if (mButtonCircle->isChecked()) + mBrushShape = CSVWidget::BrushShape_Circle; + if (mButtonCustom->isChecked()) + mBrushShape = CSVWidget::BrushShape_Custom; emit passBrushShape(mBrushShape); }