From: divverent Date: Fri, 18 Dec 2009 08:03:34 +0000 (+0000) Subject: some fixes, and patch bobtoolz improvements, from osxnetradiant X-Git-Tag: svn-r421~17 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=71562074b6b78aa5edaf908b24b00c75fcc5fe78;p=xonotic%2Fnetradiant.git some fixes, and patch bobtoolz improvements, from osxnetradiant git-svn-id: svn://svn.icculus.org/netradiant/trunk@403 61c419a2-8eb2-4b30-bcec-8cead039b335 --- diff --git a/Makefile b/Makefile index a6a09ac9..eb164622 100644 --- a/Makefile +++ b/Makefile @@ -184,9 +184,11 @@ ifeq ($(OS),Darwin) CFLAGS_COMMON += -fPIC CXXFLAGS_COMMON += -fno-exceptions -fno-rtti CPPFLAGS_COMMON += -I/sw/include -I/usr/X11R6/include - LDFLAGS_COMMON += -L/sw/lib -L/usr/lib -L/usr/X11R6/lib + LDFLAGS_COMMON += -L/sw/lib -L/usr/X11R6/lib + #LDFLAGS_COMMON += -L/sw/lib -L/usr/lib -L/usr/X11R6/lib LDFLAGS_DLL += -dynamiclib -ldl EXE ?= ppc + MACLIBDIR ?= /sw/lib A = a DLL = dylib MWINDOWS = @@ -906,12 +908,12 @@ $(INSTALLDIR)/plugins/ufoaiplug.$(DLL): \ contrib/ufoaiplug/ufoai_level.o \ contrib/ufoaiplug/ufoai.o \ -#$(INSTALLDIR)/plugins/bkgrnd2d.$(DLL): LIBS_EXTRA := $(LIBS_GLIB) $(LIBS_GTK) -#$(INSTALLDIR)/plugins/bkgrnd2d.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) -Ilibs -Iinclude -#$(INSTALLDIR)/plugins/bkgrnd2d.$(DLL): \ -# contrib/bkgrnd2d/bkgrnd2d.o \ -# contrib/bkgrnd2d/dialog.o \ -# contrib/bkgrnd2d/plugin.o \ +$(INSTALLDIR)/plugins/bkgrnd2d.$(DLL): LIBS_EXTRA := $(LIBS_GLIB) $(LIBS_GTK) +$(INSTALLDIR)/plugins/bkgrnd2d.$(DLL): CPPFLAGS_EXTRA := $(CPPFLAGS_GLIB) $(CPPFLAGS_GTK) -Ilibs -Iinclude +$(INSTALLDIR)/plugins/bkgrnd2d.$(DLL): \ + contrib/bkgrnd2d/bkgrnd2d.o \ + contrib/bkgrnd2d/dialog.o \ + contrib/bkgrnd2d/plugin.o \ $(INSTALLDIR)/heretic2/h2data.$(EXE): LIBS_EXTRA := $(LIBS_XML) $(INSTALLDIR)/heretic2/h2data.$(EXE): CPPFLAGS_EXTRA := $(CPPFLAGS_XML) -Itools/quake2/qdata_heretic2/common -Itools/quake2/qdata_heretic2/qcommon -Itools/quake2/qdata_heretic2 -Itools/quake2/common -Ilibs -Iinclude @@ -978,7 +980,7 @@ install-dll: binaries else ifeq ($(OS),Darwin) install-dll: binaries - CP="$(CP)" OTOOL="$(OTOOL)" INSTALLDIR="$(INSTALLDIR)" $(SH) install-dylibs.sh + EXE="$(EXE)" MACLIBDIR="$(MACLIBDIR)" CP="$(CP)" OTOOL="$(OTOOL)" INSTALLDIR="$(INSTALLDIR)" $(SH) install-dylibs.sh else install-dll: binaries @$(ECHO) No DLL inclusion implemented for this target. diff --git a/Makefile.conf b/Makefile.conf index 0f5fa924..29865455 100644 --- a/Makefile.conf +++ b/Makefile.conf @@ -1 +1,18 @@ # empty Makefile.conf template + +## OS X: +# BUILD=debug +# RADIANT_ABOUTMSG=Custom build +# EXE=ub +# +## MacPorts: +# CPPFLAGS=-I/opt/local/include/ -I/usr/X11R6/include/ +# LDFLAGS=-L/opt/local/lib -L/usr/X11R6/lib +# MACLIBDIR=/opt/local/lib + +## Fink +## (-arch ppc can combined with -arch 386, I read somewhere. However does work fine like this on OSX 10.6) +# LDFLAGS=-arch i386 +# CFLAGS=-arch i386 +# TARGET_ARCH=-arch i386 +# MACLIBDIR=/sw/lib diff --git a/contrib/bobtoolz/DPatch.cpp b/contrib/bobtoolz/DPatch.cpp index 30bb5c60..259355ec 100644 --- a/contrib/bobtoolz/DPatch.cpp +++ b/contrib/bobtoolz/DPatch.cpp @@ -307,29 +307,31 @@ DPatch* DPatch::MergePatches(patch_merge_t merge_info, DPatch *p1, DPatch *p2) if(merge_info.pos2 < 0) merge_info.pos2 += 3; } - - int newHeight = p1->height + p2->height - 1; + // + /* The Patch will never be reaching max, previous comparissions make sure, + for 2 patches with 3x3 size. Results always in a patch of 3x5. (31 is max currently) + int newHeight = p1->height + p2->height - 1; anyway = 5 if(newHeight > MAX_PATCH_HEIGHT) return NULL; - + int newWidth = p1->width + p2->width - 1; + if(newWidth > MAX_PATCH_WIDTH) + return NULL; + */ DPatch* newPatch = new DPatch(); - newPatch->height = newHeight; - newPatch->width = p1->width; + newPatch->height = 3; + newPatch->width = 5; newPatch->SetTexture(p1->texture); - int y = 0; - int i; - for(i = 0; i < p1->height; i++, y++) - for(int x = 0; x < p1->width; x++) - newPatch->points[x][y] = p1->points[x][i]; - - for(i = 1; i < p2->height; i++, y++) - for(int x = 0; x < p2->width; x++) - newPatch->points[x][y] = p2->points[x][i]; - + for(int y = 0; y < 3; y++) + for(int x = 0; x < 3; x++) + newPatch->points[x][y] = p1->points[x][y]; + + for(int y = 1; y < 3; y++) + for(int x = 0; x < 3; x++) + newPatch->points[x][y+2] = p2->points[x][y]; + // newPatch->Invert(); - return newPatch; } @@ -396,13 +398,13 @@ void DPatch::Transpose() Invert(); } -std::list DPatch::Split(bool rows, bool cols) +std::list DPatch::SplitRows() { std::list patchList; int i; int x, y; - if(rows && height >= 5) + if(height >= 5) { for(i = 0; i < (height-1)/2; i++) { @@ -411,53 +413,162 @@ std::list DPatch::Split(bool rows, bool cols) p.width = width; p.height = 3; p.SetTexture(texture); + for(x = 0; x < 3; x++) + { + for(y = 0; y < p.width; y++) + { + p.points[x][y] = points[(i*2)+x][y]; + } + } + patchList.push_back(p); + } + } else { + //This returns exactly what comes in.. I don't know better :/ + //If nothing is returned, the Patch in Radiant is just deleted - I suppose for evil follow up erros. + DPatch p; + + p.height = height; + p.width = width; + p.SetTexture(texture); + + for(x = 0; x < p.height; x++) + { + for(y = 0; y < p.width; y++) + { + p.points[x][y] = points[x][y]; + } + } + patchList.push_back(p); + } + return patchList; +} - for(y = 0; y < 3; y++) +std::list DPatch::SplitCols() +{ + std::list patchList; + int i; + int x, y; + + if(width >= 5) + { + for(i = 0; i < (width-1)/2; i++) + { + DPatch p; + + p.width = 3; + p.height = height; + p.SetTexture(texture); + + for(x = 0; x < p.height; x++) { - for(x = 0; x < p.width; x++) + for(y = 0; y < 3; y++) { p.points[x][y] = points[x][(i*2)+y]; } } patchList.push_back(p); } - - if(cols && width >= 5) + } else + { + //This returns exactly what comes in.. I don't know better :/ + //If nothing is returned, the Patch in Radiant is just deleted - I suppose for evil follow up erros. + DPatch p; + + p.height = height; + p.width = width; + p.SetTexture(texture); + + for(x = 0; x < p.height; x++) { - std::list patchList2; - - for(std::list::iterator patches = patchList.begin(); patches != patchList.end(); patches++) + for(y = 0; y < p.width; y++) { - std::list patchList3 = (*patches).Split(false, true); - - for(std::list::iterator patches2 = patchList3.begin(); patches2 != patchList3.end(); patches2++) - patchList2.push_front(*patches2); + p.points[x][y] = points[x][y]; } - - return patchList2; } + patchList.push_back(p); } - else if(cols && width >= 5) + return patchList; +} + +std::list DPatch::Split() +{ + std::list patchList; + int i; + int x, y; + + if(width >= 5) { for(i = 0; i < (width-1)/2; i++) { DPatch p; - - p.height = height; + p.width = 3; + p.height = height; + p.SetTexture(texture); + + for(x = 0; x < p.height; x++) + { + for(y = 0; y < 3; y++) + { + p.points[x][y] = points[x][(i*2)+y]; + } + } + patchList.push_back(p); + } + std::list patchList2; + for(std::list::iterator patches = patchList.begin(); patches != patchList.end(); patches++) + { + std::list patchList3 = (*patches).SplitRows(); + for(std::list::iterator patches2 = patchList3.begin(); patches2 != patchList3.end(); patches2++) + patchList2.push_front(*patches2); + } + return patchList2; + + } else if(height >= 5) + { + for(i = 0; i < (height-1)/2; i++) + { + DPatch p; + + p.width = width; + p.height = 3; p.SetTexture(texture); - for(x = 0; x < 3; x++) { - for(y = 0; y < p.height; y++) + for(y = 0; y < p.width; y++) { p.points[x][y] = points[(i*2)+x][y]; } - } - + } patchList.push_back(p); + } + std::list patchList2; + for(std::list::iterator patches = patchList.begin(); patches != patchList.end(); patches++) + { + std::list patchList3 = (*patches).SplitCols(); + for(std::list::iterator patches2 = patchList3.begin(); patches2 != patchList3.end(); patches2++) + patchList2.push_front(*patches2); } + return patchList2; + + } else + { + //This returns exactly what comes in.. I don't know better :/ + //If nothing is returned, the Patch in Radiant is just deleted - I suppose for evil follow up erros. + DPatch p; + + p.height = height; + p.width = width; + p.SetTexture(texture); + + for(x = 0; x < p.height; x++) + { + for(y = 0; y < p.width; y++) + { + p.points[x][y] = points[x][y]; + } + } + patchList.push_back(p); } - return patchList; } diff --git a/contrib/bobtoolz/DPatch.h b/contrib/bobtoolz/DPatch.h index 32439189..5a956f92 100644 --- a/contrib/bobtoolz/DPatch.h +++ b/contrib/bobtoolz/DPatch.h @@ -46,15 +46,17 @@ namespace scene class Instance; } -#define MAX_PATCH_WIDTH 16 -#define MAX_PATCH_HEIGHT 16 +#define MAX_PATCH_WIDTH 32 +#define MAX_PATCH_HEIGHT 32 #define MIN_PATCH_WIDTH 3 #define MIN_PATCH_HEIGHT 3 class DPatch { public: - std::list Split(bool rows, bool cols); + std::list SplitRows(); + std::list SplitCols(); + std::list Split(); void Transpose(); void Invert(); DPatch* MergePatches(patch_merge_t merge_info, DPatch* p1, DPatch* p2); diff --git a/contrib/bobtoolz/bobToolz-GTK.cpp b/contrib/bobtoolz/bobToolz-GTK.cpp index be4f7804..6e868be6 100644 --- a/contrib/bobtoolz/bobToolz-GTK.cpp +++ b/contrib/bobtoolz/bobToolz-GTK.cpp @@ -62,7 +62,7 @@ void BobToolz_destroy() char* PLUGIN_NAME = "bobToolz"; // commands in the menu -static char* PLUGIN_COMMANDS = "About...,-,Reset Textures...,PitOMatic,-,Vis Viewer,Brush Cleanup,Polygon Builder,Caulk Selection,-,Tree Planter,Drop Entity,Plot Splines,-,Merge Patches,Split patches,Turn edge"; +static char* PLUGIN_COMMANDS = "About...,-,Reset Textures...,PitOMatic,-,Vis Viewer,Brush Cleanup,Polygon Builder,Caulk Selection,-,Tree Planter,Drop Entity,Plot Splines,-,Merge Patches,Split patches,Split patches cols,Split patches rows,Turn edge"; // globals GtkWidget *g_pRadiantWnd = NULL; @@ -106,6 +106,10 @@ extern "C" void QERPlug_Dispatch (const char *p, vec3_t vMin, vec3_t vMax, bool DoMergePatches(); } else if( string_equal_nocase( p, "split patches" ) ) { DoSplitPatch(); + } else if( string_equal_nocase( p, "split patches rows" ) ) { + DoSplitPatchRows(); + } else if( string_equal_nocase( p, "split patches cols" ) ) { + DoSplitPatchCols(); } else if( string_equal_nocase( p, "turn edge" ) ) { DoFlipTerrain(); } else if( string_equal_nocase(p, "reset textures...") ) { diff --git a/contrib/bobtoolz/funchandlers-GTK.cpp b/contrib/bobtoolz/funchandlers-GTK.cpp index 5d1f16a9..5e7b25ce 100644 --- a/contrib/bobtoolz/funchandlers-GTK.cpp +++ b/contrib/bobtoolz/funchandlers-GTK.cpp @@ -499,7 +499,7 @@ void DoSplitPatch() { patch.LoadFromPatch(instance); - std::list patchList = patch.Split( true, true ); + std::list patchList = patch.Split(); for(std::list::iterator patches = patchList.begin(); patches != patchList.end(); patches++) { (*patches).BuildInRadiant(); } @@ -507,6 +507,64 @@ void DoSplitPatch() { Path_deleteTop(instance.path()); } +void DoSplitPatchCols() { + UndoableCommand undo("bobToolz.splitPatchCols"); + + DPatch patch; + + // ensure we have something selected + if( GlobalSelectionSystem().countSelected() != 1 ) + { + DoMessageBox("Invalid number of patches selected, choose 1 only", "Error", eMB_OK); + return; + } + + scene::Instance& instance = GlobalSelectionSystem().ultimateSelected(); + + if( !Node_isPatch(instance.path().top()) ) { + DoMessageBox("You must select ONLY patches", "Error", eMB_OK); + return; + } + + patch.LoadFromPatch(instance); + + std::list patchList = patch.SplitCols(); + for(std::list::iterator patches = patchList.begin(); patches != patchList.end(); patches++) { + (*patches).BuildInRadiant(); + } + + Path_deleteTop(instance.path()); +} + +void DoSplitPatchRows() { + UndoableCommand undo("bobToolz.splitPatchRows"); + + DPatch patch; + + // ensure we have something selected + if( GlobalSelectionSystem().countSelected() != 1 ) + { + DoMessageBox("Invalid number of patches selected, choose 1 only", "Error", eMB_OK); + return; + } + + scene::Instance& instance = GlobalSelectionSystem().ultimateSelected(); + + if( !Node_isPatch(instance.path().top()) ) { + DoMessageBox("You must select ONLY patches", "Error", eMB_OK); + return; + } + + patch.LoadFromPatch(instance); + + std::list patchList = patch.SplitRows(); + for(std::list::iterator patches = patchList.begin(); patches != patchList.end(); patches++) { + (*patches).BuildInRadiant(); + } + + Path_deleteTop(instance.path()); +} + void DoVisAnalyse() { char filename[1024]; diff --git a/contrib/bobtoolz/funchandlers.h b/contrib/bobtoolz/funchandlers.h index 8be283fd..3f4202ff 100644 --- a/contrib/bobtoolz/funchandlers.h +++ b/contrib/bobtoolz/funchandlers.h @@ -62,6 +62,8 @@ void DoPitBuilder(); void DoCTFColourChanger(); void DoMergePatches(); void DoSplitPatch(); +void DoSplitPatchRows(); +void DoSplitPatchCols(); void DoVisAnalyse(); void DoTrainThing(); void DoTrainPathPlot(); diff --git a/install-dylibs.sh b/install-dylibs.sh index 107e477d..cdb7dc73 100644 --- a/install-dylibs.sh +++ b/install-dylibs.sh @@ -5,10 +5,12 @@ set -ex : ${OTOOL:=otool} : ${CP:=cp} : ${INSTALLDIR:=.} +: ${EXE:=ppc} +: ${MACLIBDIR:=/sw/lib} finkgetdeps() { - otool -L "$1" | grep /sw/lib | while read -r LIB STUFF; do + otool -L "$1" | grep "$MACLIBDIR" | while read -r LIB STUFF; do [ -z "${LIB##*:}" ] && continue # first line [ -f "$INSTALLDIR/${LIB##*/}" ] && continue cp -vL "$LIB" "$INSTALLDIR" @@ -16,22 +18,22 @@ finkgetdeps() done } -finkgetdeps "$INSTALLDIR/radiant.ppc" +finkgetdeps "$INSTALLDIR/radiant.$EXE" echo Warning: this only works if only ONE version of gtk-2.0 and pango is installed -for LIB in /sw/lib/gtk-2.0/*/loaders/libpixbufloader-bmp.so; do +for LIB in "$MACLIBDIR"/gtk-2.0/*/loaders/libpixbufloader-bmp.so; do LAST=$LIB done cp -L "$LAST" "$INSTALLDIR" finkgetdeps "$LAST" -for LIB in /sw/lib/pango/*/modules/pango-basic-fc.so; do +for LIB in "$MACLIBDIR"/pango/*/modules/pango-basic-fc.so; do LAST=$LIB done cp -L "$LAST" "$INSTALLDIR" finkgetdeps "$LAST" -for LIB in /sw/lib/pango/*/modules/pango-basic-x.so; do +for LIB in "$MACLIBDIR"/pango/*/modules/pango-basic-x.so; do LAST=$LIB done cp -L "$LAST" "$INSTALLDIR" diff --git a/setup/data/osx/NetRadiant.app/Contents/MacOS/install/fonts.conf b/setup/data/osx/NetRadiant.app/Contents/MacOS/install/fonts.conf new file mode 100755 index 00000000..86dc8af2 --- /dev/null +++ b/setup/data/osx/NetRadiant.app/Contents/MacOS/install/fonts.conf @@ -0,0 +1,150 @@ + + + + + + + + + + /usr/share/fonts + /usr/X11/lib/X11/fonts /Library/Fonts /Network/Library/Fonts /System/Library/Fonts /opt/local/share/fonts + ~/.fonts + + + + + mono + + + monospace + + + + + + + sans serif + + + sans-serif + + + + + + + sans + + + sans-serif + + + + + conf.d + + + + ~/.fontconfig + + + + + 0x0020 + 0x00A0 + 0x00AD + 0x034F + 0x0600 + 0x0601 + 0x0602 + 0x0603 + 0x06DD + 0x070F + 0x115F + 0x1160 + 0x1680 + 0x17B4 + 0x17B5 + 0x180E + 0x2000 + 0x2001 + 0x2002 + 0x2003 + 0x2004 + 0x2005 + 0x2006 + 0x2007 + 0x2008 + 0x2009 + 0x200A + 0x200B + 0x200C + 0x200D + 0x200E + 0x200F + 0x2028 + 0x2029 + 0x202A + 0x202B + 0x202C + 0x202D + 0x202E + 0x202F + 0x205F + 0x2060 + 0x2061 + 0x2062 + 0x2063 + 0x206A + 0x206B + 0x206C + 0x206D + 0x206E + 0x206F + 0x2800 + 0x3000 + 0x3164 + 0xFEFF + 0xFFA0 + 0xFFF9 + 0xFFFA + 0xFFFB + + + + 30 + + + + diff --git a/setup/data/osx/NetRadiant.app/Contents/MacOS/install/fonts.dtd b/setup/data/osx/NetRadiant.app/Contents/MacOS/install/fonts.dtd new file mode 100755 index 00000000..cbdfdab3 --- /dev/null +++ b/setup/data/osx/NetRadiant.app/Contents/MacOS/install/fonts.dtd @@ -0,0 +1,224 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/setup/data/osx/NetRadiant.app/Contents/MacOS/netradiant.sh b/setup/data/osx/NetRadiant.app/Contents/MacOS/netradiant.sh index 3df16e39..2f8bc00e 100755 --- a/setup/data/osx/NetRadiant.app/Contents/MacOS/netradiant.sh +++ b/setup/data/osx/NetRadiant.app/Contents/MacOS/netradiant.sh @@ -7,10 +7,11 @@ MY_DIRECTORY="${MY_DIRECTORY%/*}" # cut off Contents export DYLD_LIBRARY_PATH="$MY_DIRECTORY/Contents/MacOS/install" export PANGO_RC_FILE="$MY_DIRECTORY/Contents/MacOS/install/pangorc" export GDK_PIXBUF_MODULE_FILE="$MY_DIRECTORY/Contents/MacOS/install/gdk-pixbuf.loaders" +export FONTCONFIG_FILE="$MY_DIRECTORY/Contents/MacOS/install/fonts.conf" cd "$MY_DIRECTORY/Contents/MacOS/install" if [ -x /usr/bin/open-x11 ]; then - /usr/bin/open-x11 ./radiant.ppc "$@" & + /usr/bin/open-x11 ./radiant.%EXE% "$@" & else - ./radiant.ppc "$@" & + ./radiant.%EXE% "$@" & fi