Fixes by Dunk

git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/trunk@173 8a3a26a2-13c4-0310-b231-cf6edde360e5
This commit is contained in:
namespace 2007-06-28 17:55:42 +00:00
parent 0c07d03e26
commit 70fe5a7feb
9 changed files with 94 additions and 16 deletions

View File

@ -1,6 +1,12 @@
This is the changelog for developers, != changelog for the end user This is the changelog for developers, != changelog for the end user
that we distribute with the binaries. (see changelog) that we distribute with the binaries. (see changelog)
28/06/2007 (dunkfordyce@gmail.com)
- fixed mnemonics for MRU list
- fixed find functionality
- added option to always use caulk texture for new brushes
- fixed(?) a small bug in install.py that was trying to copy msvc files on linux
28/06/2007 28/06/2007
- Added material-support to brushexport-plugin (Shaderman) - Added material-support to brushexport-plugin (Shaderman)

View File

@ -36,7 +36,7 @@ JOBS
BUILD BUILD
Use debug/release to select build settings Use debug/release to select build settings
ex: BUILD="release" - default is debug ex: BUILD="release" - default is release
""" """
) )

View File

@ -113,11 +113,10 @@ copyFileIfExists(libxml2, installRoot)
libmhash = os.path.normpath(os.path.join(thisDir, "../mhash-0.9/win32/libmhash/Release/libmhash.dll")) libmhash = os.path.normpath(os.path.join(thisDir, "../mhash-0.9/win32/libmhash/Release/libmhash.dll"))
copyFileIfExists(libmhash, installRoot) copyFileIfExists(libmhash, installRoot)
copySvn("../msvc_redist", installRoot)
if sys.platform[:3] == "win" : if sys.platform[:3] == "win" :
dbghelp = os.path.normpath(os.path.join(thisDir, "../msvc_redist/dbghelp.dll")) copySvn("../msvc_redist", installRoot)
copyFileIfExists(dbghelp, installRoot) dbghelp = os.path.normpath(os.path.join(thisDir, "../msvc_redist/dbghelp.dll"))
copyFileIfExists(dbghelp, installRoot)
# create version files # create version files
version = open(os.path.join(thisDir, "include/version.default"), "rt").readline().split(".") version = open(os.path.join(thisDir, "include/version.default"), "rt").readline().split(".")

View File

@ -4170,6 +4170,14 @@ inline const Functor& Scene_ForEachBrush_ForEachFace(scene::Graph& graph, const
return functor; return functor;
} }
// d1223m
template<typename Functor>
inline const Functor& Scene_ForEachBrush_ForEachFaceInstance(scene::Graph& graph, const Functor& functor)
{
Scene_forEachBrush(graph, BrushForEachFace(FaceInstanceVisitAll<Functor>(functor)));
return functor;
}
template<typename Functor> template<typename Functor>
inline const Functor& Scene_ForEachSelectedBrush_ForEachFace(scene::Graph& graph, const Functor& functor) inline const Functor& Scene_ForEachSelectedBrush_ForEachFace(scene::Graph& graph, const Functor& functor)
{ {

View File

@ -550,19 +550,66 @@ public:
} }
}; };
class FaceFindShader
{
const char* m_find;
const char* m_replace;
public:
FaceFindShader(const char* find) : m_find(find)
{
}
void operator()(FaceInstance& faceinst) const
{
if(shader_equal(faceinst.getFace().GetShader(), m_find))
{
faceinst.setSelected(SelectionSystem::eFace, true);
}
}
};
bool DoingSearch(const char *repl)
{
return (repl == NULL || (strcmp("textures/", repl)==0));
}
void Scene_BrushFindReplaceShader(scene::Graph& graph, const char* find, const char* replace) void Scene_BrushFindReplaceShader(scene::Graph& graph, const char* find, const char* replace)
{ {
Scene_ForEachBrush_ForEachFace(graph, FaceFindReplaceShader(find, replace)); if (DoingSearch(replace))
{
Scene_ForEachBrush_ForEachFaceInstance(graph, FaceFindShader(find));
}
else
{
Scene_ForEachBrush_ForEachFace(graph, FaceFindReplaceShader(find, replace));
}
} }
void Scene_BrushFindReplaceShader_Selected(scene::Graph& graph, const char* find, const char* replace) void Scene_BrushFindReplaceShader_Selected(scene::Graph& graph, const char* find, const char* replace)
{ {
Scene_ForEachSelectedBrush_ForEachFace(graph, FaceFindReplaceShader(find, replace)); if (DoingSearch(replace))
{
Scene_ForEachSelectedBrush_ForEachFaceInstance(graph,
FaceFindShader(find));
}
else
{
Scene_ForEachSelectedBrush_ForEachFace(graph,
FaceFindReplaceShader(find, replace));
}
} }
// TODO: find for components
// d1223m: dont even know what they are...
void Scene_BrushFindReplaceShader_Component_Selected(scene::Graph& graph, const char* find, const char* replace) void Scene_BrushFindReplaceShader_Component_Selected(scene::Graph& graph, const char* find, const char* replace)
{ {
Scene_ForEachSelectedBrushFace(graph, FaceFindReplaceShader(find, replace)); if (DoingSearch(replace))
{
}
else
{
Scene_ForEachSelectedBrushFace(graph, FaceFindReplaceShader(find, replace));
}
} }
@ -678,6 +725,7 @@ public:
} }
void operator()(FaceInstance& face) const void operator()(FaceInstance& face) const
{ {
printf("checking %s = %s\n", face.getFace().GetShader(), m_name);
if(shader_equal(face.getFace().GetShader(), m_name)) if(shader_equal(face.getFace().GetShader(), m_name))
{ {
face.setSelected(SelectionSystem::eFace, true); face.setSelected(SelectionSystem::eFace, true);

View File

@ -36,6 +36,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
LatchedBool g_useAlternativeTextureProjection(false, "Use alternative texture-projection"); LatchedBool g_useAlternativeTextureProjection(false, "Use alternative texture-projection");
bool g_showAlternativeTextureProjectionOption = false; bool g_showAlternativeTextureProjectionOption = false;
bool g_brush_always_caulk;
bool getTextureLockEnabled() bool getTextureLockEnabled()
{ {
@ -73,6 +74,11 @@ void Brush_constructPreferences(PreferencesPage& page)
BoolExportCaller(g_useAlternativeTextureProjection.m_latched) BoolExportCaller(g_useAlternativeTextureProjection.m_latched)
); );
} }
// d1223m
page.appendCheckBox("",
"Always use caulk for new brushes",
g_brush_always_caulk
);
} }
void Brush_constructPage(PreferenceGroup& group) void Brush_constructPage(PreferenceGroup& group)
{ {
@ -102,6 +108,12 @@ void Brush_Construct(EBrushType type)
{ {
type = eBrushTypeQuake3BP; type = eBrushTypeQuake3BP;
} }
// d1223m
GlobalPreferenceSystem().registerPreference(
"BrushAlwaysCaulk",
BoolImportStringCaller(g_brush_always_caulk),
BoolExportStringCaller(g_brush_always_caulk));
} }
Brush_registerCommands(); Brush_registerCommands();

View File

@ -91,8 +91,9 @@ namespace
void FindTextureDialog_apply() void FindTextureDialog_apply()
{ {
StringOutputStream find(256); StringOutputStream find(256);
find << "textures/" << g_FindTextureDialog.m_strFind.c_str();
StringOutputStream replace(256); StringOutputStream replace(256);
find << "textures/" << g_FindTextureDialog.m_strFind.c_str();
replace << "textures/" << g_FindTextureDialog.m_strReplace.c_str(); replace << "textures/" << g_FindTextureDialog.m_strReplace.c_str();
FindReplaceTextures(find.c_str(), replace.c_str(), g_FindTextureDialog.m_bSelectedOnly); FindReplaceTextures(find.c_str(), replace.c_str(), g_FindTextureDialog.m_bSelectedOnly);
} }

View File

@ -90,7 +90,6 @@ inline EscapedMnemonic& operator<<(EscapedMnemonic& ostream, const T& t)
void MRU_updateWidget(std::size_t index, const char *filename) void MRU_updateWidget(std::size_t index, const char *filename)
{ {
EscapedMnemonic mnemonic(64); EscapedMnemonic mnemonic(64);
mnemonic.push_back('_');
mnemonic << Unsigned(index + 1) << "- " << ConvertLocaleToUTF8(filename); mnemonic << Unsigned(index + 1) << "- " << ConvertLocaleToUTF8(filename);
gtk_label_set_text_with_mnemonic(GTK_LABEL(gtk_bin_get_child(GTK_BIN(MRU_items[index]))), mnemonic.c_str()); gtk_label_set_text_with_mnemonic(GTK_LABEL(gtk_bin_get_child(GTK_BIN(MRU_items[index]))), mnemonic.c_str());
} }
@ -214,22 +213,22 @@ LoadMRU g_load_mru4(4);
void MRU_constructMenu(GtkMenu* menu) void MRU_constructMenu(GtkMenu* menu)
{ {
{ {
GtkMenuItem* item = create_menu_item_with_mnemonic(menu, "Recent Files", LoadMRUCaller(g_load_mru1)); GtkMenuItem* item = create_menu_item_with_mnemonic(menu, "_1", LoadMRUCaller(g_load_mru1));
gtk_widget_set_sensitive(GTK_WIDGET(item), FALSE); gtk_widget_set_sensitive(GTK_WIDGET(item), FALSE);
MRU_AddWidget(item, 0); MRU_AddWidget(item, 0);
} }
{ {
GtkMenuItem* item = create_menu_item_with_mnemonic(menu, "2", LoadMRUCaller(g_load_mru2)); GtkMenuItem* item = create_menu_item_with_mnemonic(menu, "_2", LoadMRUCaller(g_load_mru2));
gtk_widget_hide(GTK_WIDGET(item)); gtk_widget_hide(GTK_WIDGET(item));
MRU_AddWidget(item, 1); MRU_AddWidget(item, 1);
} }
{ {
GtkMenuItem* item = create_menu_item_with_mnemonic(menu, "3", LoadMRUCaller(g_load_mru3)); GtkMenuItem* item = create_menu_item_with_mnemonic(menu, "_3", LoadMRUCaller(g_load_mru3));
gtk_widget_hide(GTK_WIDGET(item)); gtk_widget_hide(GTK_WIDGET(item));
MRU_AddWidget(item, 2); MRU_AddWidget(item, 2);
} }
{ {
GtkMenuItem* item = create_menu_item_with_mnemonic(menu, "4", LoadMRUCaller(g_load_mru4)); GtkMenuItem* item = create_menu_item_with_mnemonic(menu, "_4", LoadMRUCaller(g_load_mru4));
gtk_widget_hide(GTK_WIDGET(item)); gtk_widget_hide(GTK_WIDGET(item));
MRU_AddWidget(item, 3); MRU_AddWidget(item, 3);
} }

View File

@ -66,7 +66,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "windowobservers.h" #include "windowobservers.h"
// d1223m
extern bool g_brush_always_caulk;
//!\todo Rewrite. //!\todo Rewrite.
class ClipPoint class ClipPoint
@ -1109,7 +1110,11 @@ void XYWnd::NewBrushDrag(int x, int y)
m_NewBrushDrag = node.get_pointer(); m_NewBrushDrag = node.get_pointer();
} }
Scene_BrushResize_Selected(GlobalSceneGraph(), aabb_for_minmax(mins, maxs), TextureBrowser_GetSelectedShader(GlobalTextureBrowser())); // d1223m
//Scene_BrushResize_Selected(GlobalSceneGraph(), aabb_for_minmax(mins, maxs), TextureBrowser_GetSelectedShader(GlobalTextureBrowser()));
Scene_BrushResize_Selected(GlobalSceneGraph(), aabb_for_minmax(mins, maxs),
g_brush_always_caulk ?
"textures/common/caulk" : TextureBrowser_GetSelectedShader(GlobalTextureBrowser()));
} }
void entitycreate_activated(GtkWidget* item) void entitycreate_activated(GtkWidget* item)