Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#5231: Extract IShaderClipboard interface to be used by the mouse too…
…ls to pick/copy/paste shaders. Move Map classes to core module.
- Loading branch information
1 parent
4369d2e
commit ec46d4e
Showing
88 changed files
with
424 additions
and
373 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#pragma once | ||
|
||
#include "imodule.h" | ||
#include "iselectiontest.h" | ||
|
||
namespace selection | ||
{ | ||
|
||
enum class PasteMode | ||
{ | ||
// Shader is projected using the texdef matrix in the source | ||
Projected, | ||
|
||
// If a patch is hit, the algorithm will take the surface | ||
// topology of the patch into account, to avoid distortions. | ||
Natural, | ||
}; | ||
|
||
/** | ||
* Public interface of the shader clipboard which is able | ||
* to pick/copy/paste shaders from and to Texturable objects. | ||
*/ | ||
class IShaderClipboard : | ||
public RegisterableModule | ||
{ | ||
public: | ||
virtual ~IShaderClipboard() {} | ||
|
||
virtual void pickFromSelectionTest(SelectionTest& test) = 0; | ||
|
||
/** | ||
* Pastes the shader from the source in the clipboard to the object | ||
* located by the given selection test. | ||
* | ||
* @pasteToAllFaces: if a brush is hit, the source shader will be pasted | ||
* to all its faces, not just the one hit by the selection test. | ||
* | ||
* Might throw a cmd::ExecutionFailure. | ||
*/ | ||
virtual void pasteShader(SelectionTest& test, PasteMode mode, bool pasteToAllFaces) = 0; | ||
|
||
/** | ||
* Will attempt to apply the texture coordinates of the source patch to the | ||
* target patch located by the given SelectionTest. | ||
* Will throw a cmd::ExecutionFailure if the source or target objects are not matching up. | ||
*/ | ||
virtual void pasteTextureCoords(SelectionTest& test) = 0; | ||
|
||
/** | ||
* Applies the material only to the object hit by the given selection test. | ||
* Will leave the rest of the surface properties unchanged, if possible. | ||
*/ | ||
virtual void pasteMaterialName(SelectionTest& test) = 0; | ||
}; | ||
|
||
} // namespace | ||
|
||
const char* const MODULE_SHADERCLIPBOARD("ShaderClipboard"); | ||
|
||
inline selection::IShaderClipboard& GlobalShaderClipboard() | ||
{ | ||
// Cache the reference locally | ||
static selection::IShaderClipboard& _clipboard( | ||
*std::static_pointer_cast<selection::IShaderClipboard>( | ||
module::GlobalModuleRegistry().getModule(MODULE_SHADERCLIPBOARD) | ||
) | ||
); | ||
return _clipboard; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.