* -brightness 0..alot, def 1: mimics q3map_lightmapBrightness, but globally + affects vertexlight
	* -contrast -255..255, def 0: lighting contrast
	* packer improvements

Radiant:

binds...
	* entity inspector: Tab enters Key field, toggles between key/value fields; Del deletes keys; Esc quits

misc...
	* improved mwheel 2d zoom by Neumond
	* +makeRoom: like hollow, but extrudes faces outwards; for making rooms
	* deactivating tex dirs tree after loading dir, so SPACE and ENTER aren't broken for 2D after that
	* Regular, RegularLeft layouts: smaller console, bigger tex browser
	* Rotate, Scale dialogs: values aren't erased on Enter, OK, Apply (are on cancel, esc)
	* Rotate dialog: fix: new value in focused field wasn't taking in account on Enter
	* +updating texture directories list on 'flush and reload shaders' (reloading shaderlist aswell)
	* NumLock perspective window fix
	* ctrl+k(ConnectEntities): friendlier to complex connections, takes in account existing keys
		(priority: target > targetname > none)
	* +'all Supported formats' default option in open dialogs
	* defaulted show light radii
	* camera fov: 90->110
	* cubic clip: off by default; bigger def dist; fixed button's shortcut tip
	* prefs: Min & Max texture thumbnail size + dependant on scale;
		def = *scale .5, min 48, max 160 (makes range 96-320 visually differentiated)
This commit is contained in:
Garux
2017-08-01 13:57:26 +03:00
parent 7d7436ec3d
commit 0fb65a91c7
23 changed files with 402 additions and 139 deletions

View File

@@ -132,7 +132,7 @@ typedef ReferenceCaller1<TextureGroups, const char*, TextureGroups_addDirectory>
namespace
{
bool g_TextureBrowser_shaderlistOnly = false;
bool g_TextureBrowser_fixedSize = false;
bool g_TextureBrowser_fixedSize = true;
bool g_TextureBrowser_filterNotex = false;
}
@@ -264,40 +264,78 @@ bool m_searchedTags;
bool m_tags;
// The uniform size (in pixels) that textures are resized to when m_resizeTextures is true.
int m_uniformTextureSize;
int m_uniformTextureMinSize;
// Return the display width of a texture in the texture browser
int getTextureWidth( qtexture_t* tex ){
int width;
/*void getTextureWH( qtexture_t* tex, int *width, int *height ){
if ( !g_TextureBrowser_fixedSize ) {
// Don't use uniform size
width = (int)( tex->width * ( (float)m_textureScale / 100 ) );
*width = (int)( tex->width * ( (float)m_textureScale / 100 ) );
*height = (int)( tex->height * ( (float)m_textureScale / 100 ) );
}
else if
( tex->width >= tex->height ) {
else if ( tex->width >= tex->height ) {
// Texture is square, or wider than it is tall
width = m_uniformTextureSize;
if ( tex->width >= m_uniformTextureSize ){
*width = m_uniformTextureSize;
*height = (int)( m_uniformTextureSize * ( (float)tex->height / tex->width ) );
}
else if ( tex->width <= m_uniformTextureMinSize ){
*width = m_uniformTextureMinSize;
*height = (int)( m_uniformTextureMinSize * ( (float)tex->height / tex->width ) );
}
else {
*width = tex->width;
*height = tex->height;
}
}
else {
// Otherwise, preserve the texture's aspect ratio
width = (int)( m_uniformTextureSize * ( (float)tex->width / tex->height ) );
// Texture taller than it is wide
if ( tex->height >= m_uniformTextureSize ){
*height = m_uniformTextureSize;
*width = (int)( m_uniformTextureSize * ( (float)tex->width / tex->height ) );
}
else if ( tex->height <= m_uniformTextureMinSize ){
*height = m_uniformTextureMinSize;
*width = (int)( m_uniformTextureMinSize * ( (float)tex->width / tex->height ) );
}
else {
*width = tex->width;
*height = tex->height;
}
}
return width;
}
// Return the display height of a texture in the texture browser
int getTextureHeight( qtexture_t* tex ){
int height;
if ( !g_TextureBrowser_fixedSize ) {
*/
void getTextureWH( qtexture_t* tex, int *width, int *height ){
// Don't use uniform size
height = (int)( tex->height * ( (float)m_textureScale / 100 ) );
*width = (int)( tex->width * ( (float)m_textureScale / 100 ) );
*height = (int)( tex->height * ( (float)m_textureScale / 100 ) );
if ( g_TextureBrowser_fixedSize ){
int W = *width;
int H = *height;
if ( W >= H ) {
// Texture is square, or wider than it is tall
if ( W >= m_uniformTextureSize ){
*width = m_uniformTextureSize;
*height = m_uniformTextureSize * H / W;
}
else if ( W <= m_uniformTextureMinSize ){
*width = m_uniformTextureMinSize;
*height = m_uniformTextureMinSize * H / W;
}
}
else {
// Texture taller than it is wide
if ( H >= m_uniformTextureSize ){
*height = m_uniformTextureSize;
*width = m_uniformTextureSize * W / H;
}
else if ( H <= m_uniformTextureMinSize ){
*height = m_uniformTextureMinSize;
*width = m_uniformTextureMinSize * W / H;
}
}
}
else if ( tex->height >= tex->width ) {
// Texture is square, or taller than it is wide
height = m_uniformTextureSize;
}
else {
// Otherwise, preserve the texture's aspect ratio
height = (int)( m_uniformTextureSize * ( (float)tex->height / tex->width ) );
}
return height;
}
TextureBrowser() :
@@ -320,7 +358,8 @@ TextureBrowser() :
m_rmbSelected( false ),
m_searchedTags( false ),
m_tags( false ),
m_uniformTextureSize( 128 ){
m_uniformTextureSize( 160 ),
m_uniformTextureMinSize( 48 ){
}
};
@@ -421,8 +460,8 @@ void Texture_StartPos( TextureLayout& layout ){
void Texture_NextPos( TextureBrowser& textureBrowser, TextureLayout& layout, qtexture_t* current_texture, int *x, int *y ){
qtexture_t* q = current_texture;
int nWidth = textureBrowser.getTextureWidth( q );
int nHeight = textureBrowser.getTextureHeight( q );
int nWidth, nHeight;
textureBrowser.getTextureWH( q, &nWidth, &nHeight );
if ( layout.current_x + nWidth > textureBrowser.width - 8 && layout.current_row ) { // go to the next row unless the texture is the first on the row
layout.current_x = 8;
layout.current_y -= layout.current_row + TextureBrowser_fontHeight( textureBrowser ) + 4;
@@ -534,7 +573,9 @@ void TextureBrowser_evaluateHeight( TextureBrowser& textureBrowser ){
int x, y;
Texture_NextPos( textureBrowser, layout, shader->getTexture(), &x, &y );
textureBrowser.m_nTotalHeight = std::max( textureBrowser.m_nTotalHeight, abs( layout.current_y ) + TextureBrowser_fontHeight( textureBrowser ) + textureBrowser.getTextureHeight( shader->getTexture() ) + 4 );
int nWidth, nHeight;
textureBrowser.getTextureWH( shader->getTexture(), &nWidth, &nHeight );
textureBrowser.m_nTotalHeight = std::max( textureBrowser.m_nTotalHeight, abs( layout.current_y ) + TextureBrowser_fontHeight( textureBrowser ) + nHeight + 4 );
}
}
}
@@ -581,12 +622,15 @@ void TextureBrowser_addActiveShadersChangedCallback( const SignalHandler& handle
g_activeShadersChangedCallbacks.connectLast( handler );
}
void TextureBrowser_constructTreeStore();
class ShadersObserver : public ModuleObserver
{
Signal0 m_realiseCallbacks;
public:
void realise(){
m_realiseCallbacks();
TextureBrowser_constructTreeStore();
}
void unrealise(){
}
@@ -915,8 +959,8 @@ IShader* Texture_At( TextureBrowser& textureBrowser, int mx, int my ){
break;
}
int nWidth = textureBrowser.getTextureWidth( q );
int nHeight = textureBrowser.getTextureHeight( q );
int nWidth, nHeight;
textureBrowser.getTextureWH( q, &nWidth, &nHeight );
if ( mx > x && mx - x < nWidth
&& my < y && y - my < nHeight + TextureBrowser_fontHeight( textureBrowser ) ) {
return shader;
@@ -1046,8 +1090,8 @@ void Texture_Draw( TextureBrowser& textureBrowser ){
break;
}
int nWidth = textureBrowser.getTextureWidth( q );
int nHeight = textureBrowser.getTextureHeight( q );
int nWidth, nHeight;
textureBrowser.getTextureWH( q, &nWidth, &nHeight );
if ( y != last_y ) {
last_y = y;
@@ -1167,6 +1211,15 @@ void TextureBrowser_setScale( TextureBrowser& textureBrowser, std::size_t scale
TextureBrowser_queueDraw( textureBrowser );
}
void TextureBrowser_setUniformSize( TextureBrowser& textureBrowser, std::size_t scale ){
textureBrowser.m_uniformTextureSize = scale;
TextureBrowser_queueDraw( textureBrowser );
}
void TextureBrowser_setUniformMinSize( TextureBrowser& textureBrowser, std::size_t scale ){
textureBrowser.m_uniformTextureMinSize = scale;
TextureBrowser_queueDraw( textureBrowser );
}
void TextureBrowser_MouseWheel( TextureBrowser& textureBrowser, bool bUp ){
int originy = TextureBrowser_getOriginY( textureBrowser );
@@ -1477,6 +1530,8 @@ void TreeView_onRowActivated( GtkTreeView* treeview, GtkTreePath* path, GtkTreeV
ScopeDisableScreenUpdates disableScreenUpdates( dirName, "Loading Textures" );
TextureBrowser_ShowDirectory( GlobalTextureBrowser(), dirName );
TextureBrowser_queueDraw( GlobalTextureBrowser() );
//deactivate, so SPACE and RETURN wont be broken for 2d
gtk_window_set_focus( GTK_WINDOW( gtk_widget_get_toplevel( GTK_WIDGET( treeview ) ) ), NULL );
}
}
@@ -2429,6 +2484,18 @@ void TextureScaleExport( TextureBrowser& textureBrowser, const IntImportCallback
}
typedef ReferenceCaller1<TextureBrowser, const IntImportCallback&, TextureScaleExport> TextureScaleExportCaller;
void UniformTextureSizeImport( TextureBrowser& textureBrowser, int value ){
if ( value >= 16 )
TextureBrowser_setUniformSize( textureBrowser, value );
}
typedef ReferenceCaller1<TextureBrowser, int, UniformTextureSizeImport> UniformTextureSizeImportCaller;
void UniformTextureMinSizeImport( TextureBrowser& textureBrowser, int value ){
if ( value >= 16 )
TextureBrowser_setUniformMinSize( textureBrowser, value );
}
typedef ReferenceCaller1<TextureBrowser, int, UniformTextureMinSizeImport> UniformTextureMinSizeImportCaller;
void TextureBrowser_constructPreferences( PreferencesPage& page ){
page.appendCheckBox(
"", "Texture scrollbar",
@@ -2444,6 +2511,8 @@ void TextureBrowser_constructPreferences( PreferencesPage& page ){
IntExportCallback( TextureScaleExportCaller( GlobalTextureBrowser() ) )
);
}
page.appendSpinner( "Thumbnails Max Size", GlobalTextureBrowser().m_uniformTextureSize, GlobalTextureBrowser().m_uniformTextureSize, 16, 8192 );
page.appendSpinner( "Thumbnails Min Size", GlobalTextureBrowser().m_uniformTextureMinSize, GlobalTextureBrowser().m_uniformTextureMinSize, 16, 8192 );
page.appendEntry( "Mousewheel Increment", GlobalTextureBrowser().m_mouseWheelScrollIncrement );
{
const char* startup_shaders[] = { "None", TextureBrowser_getComonShadersName() };
@@ -2489,6 +2558,12 @@ void TextureBrowser_Construct(){
makeSizeStringImportCallback( TextureBrowserSetScaleCaller( g_TextureBrowser ) ),
SizeExportStringCaller( g_TextureBrowser.m_textureScale )
);
GlobalPreferenceSystem().registerPreference( "UniformTextureSize",
makeIntStringImportCallback(UniformTextureSizeImportCaller(g_TextureBrowser)),
IntExportStringCaller(g_TextureBrowser.m_uniformTextureSize) );
GlobalPreferenceSystem().registerPreference( "UniformTextureMinSize",
makeIntStringImportCallback(UniformTextureMinSizeImportCaller(g_TextureBrowser)),
IntExportStringCaller(g_TextureBrowser.m_uniformTextureMinSize) );
GlobalPreferenceSystem().registerPreference( "TextureScrollbar",
makeBoolStringImportCallback( TextureBrowserImportShowScrollbarCaller( g_TextureBrowser ) ),
BoolExportStringCaller( GlobalTextureBrowser().m_showTextureScrollbar )