diff --git a/radiantcore/patch/Patch.cpp b/radiantcore/patch/Patch.cpp index 6b6310fbee..e80c9ffcb4 100644 --- a/radiantcore/patch/Patch.cpp +++ b/radiantcore/patch/Patch.cpp @@ -856,7 +856,7 @@ Patch* Patch::MakeCap(Patch* patch, patch::CapType eType, EMatrixMajor mt, bool patch->ConstructSeam(eType, &p.front(), width); // greebo: Apply natural texture to that patch, to fix the texcoord==1.#INF bug. - patch->NaturalTexture(); + patch->scaleTextureNaturally(); return patch; } @@ -1942,7 +1942,7 @@ void Patch::constructPlane(const AABB& aabb, int axis, std::size_t width, std::s vTmp[y]+=yAdj; } - NaturalTexture(); + scaleTextureNaturally(); } // Returns the dimension for the given viewtype, used by the patch prefab routines @@ -2265,7 +2265,7 @@ void Patch::ConstructPrefab(const AABB& aabb, EPatchPrefab eType, EViewType view } } - NaturalTexture(); + scaleTextureNaturally(); } namespace diff --git a/radiantcore/patch/algorithm/General.cpp b/radiantcore/patch/algorithm/General.cpp index 8c70d30bc0..ccb59e0d50 100644 --- a/radiantcore/patch/algorithm/General.cpp +++ b/radiantcore/patch/algorithm/General.cpp @@ -69,7 +69,7 @@ void thicken(const PatchNodePtr& sourcePatch, float thickness, bool createSeams, parent->addChildNode(nodes[i]); // Now the shader is realised, apply natural scale - wallPatch->NaturalTexture(); + wallPatch->scaleTextureNaturally(); // Now select the newly created patch Node_setSelected(nodes[i], true); diff --git a/radiantcore/selection/algorithm/Primitives.cpp b/radiantcore/selection/algorithm/Primitives.cpp index ea75a92c61..4b61102683 100644 --- a/radiantcore/selection/algorithm/Primitives.cpp +++ b/radiantcore/selection/algorithm/Primitives.cpp @@ -309,8 +309,8 @@ class DecalPatchCreator } // Fit the texture on it - patch->SetTextureRepeat(1,1); - patch->FlipTexture(1); + patch->fitTexture(1,1); + patch->flipTexture(1); // Insert the patch into worldspawn scene::INodePtr worldSpawnNode = GlobalMapModule().findOrInsertWorldspawn(); diff --git a/radiantcore/selection/algorithm/Shader.cpp b/radiantcore/selection/algorithm/Shader.cpp index bb029e0d19..03d2735dee 100644 --- a/radiantcore/selection/algorithm/Shader.cpp +++ b/radiantcore/selection/algorithm/Shader.cpp @@ -338,22 +338,38 @@ class ClipboardShaderApplicator void operator()(IPatch& patch) { - Texturable target; - target.patch = &patch; - target.node = patch.getPatchNode().shared_from_this(); + try + { + Texturable target; + + Patch& targetPatch = dynamic_cast(patch); - // Apply the shader (projected, not to the entire brush) - applyClipboardToTexturable(target, !_natural, false); + target.patch = &targetPatch; + target.node = targetPatch.getPatchNode().shared_from_this(); + + // Apply the shader (projected, not to the entire brush) + applyClipboardToTexturable(target, !_natural, false); + } + catch (const std::bad_cast&) + {} } void operator()(IFace& face) { - Texturable target; - target.face = &face; - target.node = face.getBrush().getBrushNode().shared_from_this(); + try + { + Texturable target; - // Apply the shader (projected, not to the entire brush) - applyClipboardToTexturable(target, !_natural, false); + // Downcast the IFace reference + Face& targetFace = dynamic_cast(face); + target.face = &targetFace; + target.node = targetFace.getBrush().getBrushNode().shared_from_this(); + + // Apply the shader (projected, not to the entire brush) + applyClipboardToTexturable(target, !_natural, false); + } + catch (const std::bad_cast&) + {} } };