From 7dd945e36a13a7659bb14a2484e0ad5698280884 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Sun, 28 Mar 2010 19:14:14 +0200 Subject: [PATCH] changes from OSXnetradiant --- Makefile | 12 +- Makefile.conf | 21 +- contrib/bobtoolz/DBobView.cpp | 36 ++- contrib/bobtoolz/DPatch.cpp | 184 +++++++++--- contrib/bobtoolz/DPatch.h | 8 +- contrib/bobtoolz/DTreePlanter.cpp | 16 +- contrib/bobtoolz/DTreePlanter.h | 2 +- contrib/bobtoolz/bobToolz-GTK.cpp | 110 +++---- contrib/bobtoolz/dialogs/dialogs-gtk.cpp | 116 +++++++- contrib/bobtoolz/dialogs/dialogs-gtk.h | 7 +- contrib/bobtoolz/funchandlers-GTK.cpp | 276 +++++++++++++----- contrib/bobtoolz/funchandlers.h | 2 + contrib/bobtoolz/shapes.cpp | 66 +++-- docs/index.html | 16 + include/igl.h | 8 +- install-dylibs.sh | 41 ++- radiant/mainframe.cpp | 4 +- radiant/patch.cpp | 29 +- .../Contents/MacOS/install/fonts.conf | 150 ++++++++++ .../Contents/MacOS/install/fonts.dtd | 224 ++++++++++++++ .../Contents/MacOS/netradiant.sh | 17 +- .../plugins/bitmaps/bobtoolz_cleanup.bmp | Bin 316 -> 1318 bytes .../tools/plugins/bitmaps/bobtoolz_merge.bmp | Bin 312 -> 1334 bytes .../tools/plugins/bitmaps/bobtoolz_poly.bmp | Bin 320 -> 1318 bytes .../tools/plugins/bitmaps/bobtoolz_split.bmp | Bin 312 -> 1334 bytes .../plugins/bitmaps/bobtoolz_splitcol.bmp | Bin 0 -> 1318 bytes .../plugins/bitmaps/bobtoolz_splitrow.bmp | Bin 0 -> 1318 bytes .../plugins/bitmaps/bobtoolz_treeplanter.bmp | Bin 356 -> 1318 bytes 28 files changed, 1097 insertions(+), 248 deletions(-) create mode 100644 docs/index.html create mode 100755 setup/data/osx/NetRadiant.app/Contents/MacOS/install/fonts.conf create mode 100755 setup/data/osx/NetRadiant.app/Contents/MacOS/install/fonts.dtd create mode 100644 setup/data/tools/plugins/bitmaps/bobtoolz_splitcol.bmp create mode 100644 setup/data/tools/plugins/bitmaps/bobtoolz_splitrow.bmp diff --git a/Makefile b/Makefile index a6a09ac9..14cfac91 100644 --- a/Makefile +++ b/Makefile @@ -184,13 +184,16 @@ 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 = - + MACVERSION ?= 16 + CPPFLAGS += -DMACVERSION="$(MACVERSION)" # workaround for weird prints ECHO_NOLF = /bin/echo -n @@ -374,6 +377,7 @@ endif %.o: %.c $(if $(findstring $(DEPEND_ON_MAKEFILE),yes),$(wildcard Makefile*),) $(CC) $< $(CFLAGS) $(CFLAGS_COMMON) $(CPPFLAGS_EXTRA) $(CPPFLAGS_COMMON) $(CPPFLAGS) $(TARGET_ARCH) -c -o $@ + $(INSTALLDIR)/q3map2.$(EXE): LIBS_EXTRA := $(LIBS_XML) $(LIBS_GLIB) $(LIBS_PNG) $(LIBS_ZLIB) $(INSTALLDIR)/q3map2.$(EXE): CPPFLAGS_EXTRA := $(CPPFLAGS_XML) $(CPPFLAGS_GLIB) $(CPPFLAGS_PNG) -Itools/quake3/common -Ilibs -Iinclude $(INSTALLDIR)/q3map2.$(EXE): \ @@ -969,6 +973,8 @@ install-data: binaries $(ECHO) $(RADIANT_MINOR_VERSION) > $(INSTALLDIR)/RADIANT_MINOR $(ECHO) $(RADIANT_MAJOR_VERSION) > $(INSTALLDIR)/RADIANT_MAJOR $(CP_R) setup/data/tools/* $(INSTALLDIR)/ + $(MKDIR) $(INSTALLDIR)/docs + $(CP_R) docs/* $(INSTALLDIR)/docs/ $(FIND) $(INSTALLDIR_BASE)/ -name .svn -exec $(RM_R) {} \; -prune .PHONY: install-dll @@ -978,7 +984,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..ef1d5bfc 100644 --- a/Makefile.conf +++ b/Makefile.conf @@ -1 +1,20 @@ -# empty Makefile.conf template +# Makefile.conf template + +## OS X: +BUILD=debug +RADIANT_ABOUTMSG=OSX NetRadiant Custom build +EXE=ub +### Snow Leopard 16, Leopard 15, Tiger 14, Panther 13 +MACVERSION=16 +# +## 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/DBobView.cpp b/contrib/bobtoolz/DBobView.cpp index 688dd7e4..aef76088 100644 --- a/contrib/bobtoolz/DBobView.cpp +++ b/contrib/bobtoolz/DBobView.cpp @@ -212,6 +212,7 @@ void DBobView::Begin(const char* trigger, const char *target, float multiplier, globalErrorStream() << "Initialization Failure in DBobView::Begin"; delete this; } + globalOutputStream() << "Initialization of Path Plotter succeeded."; } bool DBobView::UpdatePath() @@ -243,35 +244,38 @@ void DBobView_setEntity(Entity& entity, float multiplier, int points, float varG DEPair* target_ep = trigger.FindEPairByKey("target"); if(target_ep) { - const scene::Path* entTarget = FindEntityFromTargetname(target_ep->value); + const scene::Path* entTarget = FindEntityFromTargetname(target_ep->value); if(entTarget) { if(g_PathView) delete g_PathView; g_PathView = new DBobView; - Entity* target = Node_getEntity(entTarget->top()); - if(target != 0) - { - if(!bNoUpdate) - { - g_PathView->trigger = &entity; - entity.attach(*g_PathView); - g_PathView->target = target; - target->attach(*g_PathView); - } + Entity* target = Node_getEntity(entTarget->top()); + if(target != 0) + { + if(!bNoUpdate) + { + g_PathView->trigger = &entity; + entity.attach(*g_PathView); + g_PathView->target = target; + target->attach(*g_PathView); + } g_PathView->Begin(trigger_ep->value, target_ep->value, multiplier, points, varGravity, bNoUpdate, bShowExtra); - } + } + else + globalErrorStream() << "bobToolz PathPlotter: trigger_push ARGH\n"; } else - DoMessageBox("trigger_push target could not be found.", "Error", eMB_OK); + globalErrorStream() << "bobToolz PathPlotter: trigger_push target could not be found..\n"; } else - DoMessageBox("trigger_push has no target.", "Error", eMB_OK); + globalErrorStream() << "bobToolz PathPlotter: trigger_push has no target..\n"; } else - DoMessageBox("You must select a 'trigger_push' entity.", "Error", eMB_OK); + globalErrorStream() << "bobToolz PathPlotter: You must select a 'trigger_push' entity..\n"; } else - DoMessageBox("Entity must have a targetname", "Error", eMB_OK); + globalErrorStream() << "bobToolz PathPlotter: Entity must have a targetname.\n"; + return; } \ No newline at end of file diff --git a/contrib/bobtoolz/DPatch.cpp b/contrib/bobtoolz/DPatch.cpp index 30bb5c60..3bfc6a34 100644 --- a/contrib/bobtoolz/DPatch.cpp +++ b/contrib/bobtoolz/DPatch.cpp @@ -307,29 +307,30 @@ 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; + int newHeight = p1->height + p2->height - 1; if(newHeight > MAX_PATCH_HEIGHT) + return false; +/* 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; + //switched.. + newPatch->height = p1->width; + newPatch->width = newHeight; newPatch->SetTexture(p1->texture); - int y = 0; - int i; - for(i = 0; i < p1->height; i++, y++) + for(int y = 0; y < p1->height; 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++) + newPatch->points[x][y] = p1->points[x][y]; + + for(int y = 1; y < p2->height; y++) for(int x = 0; x < p2->width; x++) - newPatch->points[x][y] = p2->points[x][i]; - + newPatch->points[x][(y + p1->height - 1)] = p2->points[x][y]; + // newPatch->Invert(); - return newPatch; } @@ -396,13 +397,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 +412,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/DTreePlanter.cpp b/contrib/bobtoolz/DTreePlanter.cpp index 958bcf8b..6ad221be 100644 --- a/contrib/bobtoolz/DTreePlanter.cpp +++ b/contrib/bobtoolz/DTreePlanter.cpp @@ -217,34 +217,32 @@ void DTreePlanter::DropEntsToGround( void ) { Scene_forEachEntity(TreePlanterDropEntityIfSelected(*this)); } -void DTreePlanter::MakeChain( void ) { +void DTreePlanter::MakeChain( int linkNum, const char* linkName ) { char buffer[256]; int i; - - for(i = 0; i < m_linkNum; i++) { + for(i = 0; i < linkNum; i++) { DEntity e("info_train_spline_main"); - sprintf( buffer, "%s_pt%i", m_linkName, i ); + sprintf( buffer, "%s_pt%i", linkName, i ); e.AddEPair( "targetname", buffer ); sprintf( buffer, "0 %i 0", i * 64 ); e.AddEPair( "origin", buffer ); if(i != m_linkNum-1) { - sprintf( buffer, "%s_pt%i", m_linkName, i+1 ); + sprintf( buffer, "%s_pt%i", linkName, i+1 ); e.AddEPair( "target", buffer ); - sprintf( buffer, "%s_ctl%i", m_linkName, i ); + sprintf( buffer, "%s_ctl%i", linkName, i ); e.AddEPair( "control", buffer ); } - e.BuildInRadiant( false ); } - for(i = 0; i < m_linkNum-1; i++) { + for(i = 0; i < linkNum-1; i++) { DEntity e("info_train_spline_control"); - sprintf( buffer, "%s_ctl%i", m_linkName, i ); + sprintf( buffer, "%s_ctl%i", linkName, i ); e.AddEPair( "targetname", buffer ); sprintf( buffer, "0 %i 0", (i * 64) + 32); diff --git a/contrib/bobtoolz/DTreePlanter.h b/contrib/bobtoolz/DTreePlanter.h index 10421660..fec8910f 100644 --- a/contrib/bobtoolz/DTreePlanter.h +++ b/contrib/bobtoolz/DTreePlanter.h @@ -181,7 +181,7 @@ public: bool FindDropPoint(vec3_t in, vec3_t out); void DropEntsToGround( void ); - void MakeChain( void ); + void MakeChain( int linkNum, const char* linkName ); void SelectChain( void ); private: diff --git a/contrib/bobtoolz/bobToolz-GTK.cpp b/contrib/bobtoolz/bobToolz-GTK.cpp index be4f7804..07f7dae3 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...,-,Vis Viewer,Path Plotter...,-,Stair Builder...,PitOMatic,Make Chain...,Door Builder...,-,Texture Reset...,Intersect..."; // globals GtkWidget *g_pRadiantWnd = NULL; @@ -90,30 +90,22 @@ extern "C" const char* QERPlug_GetCommandList() { extern "C" void QERPlug_Dispatch (const char *p, vec3_t vMin, vec3_t vMax, bool bSingleBrush) { LoadLists(); - if( string_equal_nocase( p, "brush cleanup" ) ) { - DoFixBrushes(); - } else if( string_equal_nocase( p, "polygon builder" ) ) { - DoPolygonsTB(); - } else if( string_equal_nocase( p, "caulk selection" ) ) { - DoCaulkSelection(); - } else if( string_equal_nocase( p, "tree planter" ) ) { - DoTreePlanter(); - } else if( string_equal_nocase( p, "plot splines" ) ) { - DoTrainPathPlot(); - } else if( string_equal_nocase( p, "drop entity" ) ) { - DoDropEnts(); - } else if( string_equal_nocase( p, "merge patches" ) ) { - DoMergePatches(); - } else if( string_equal_nocase( p, "split patches" ) ) { - DoSplitPatch(); - } else if( string_equal_nocase( p, "turn edge" ) ) { - DoFlipTerrain(); - } else if( string_equal_nocase(p, "reset textures...") ) { + if( string_equal_nocase(p, "texture reset...") ) { DoResetTextures(); } else if( string_equal_nocase(p, "pitomatic") ) { DoPitBuilder(); } else if( string_equal_nocase(p, "vis viewer") ) { DoVisAnalyse(); + } else if( string_equal_nocase(p, "stair builder...") ) { + DoBuildStairs(); + } else if( string_equal_nocase(p, "door builder...") ) { + DoBuildDoors(); + } else if( string_equal_nocase(p, "intersect...") ) { + DoIntersect(); + } else if( string_equal_nocase(p, "make chain...") ) { + DoMakeChain(); + } else if( string_equal_nocase(p, "path plotter...") ) { + DoPathPlotter(); } else if( string_equal_nocase(p, "about...") ) { DoMessageBox(PLUGIN_ABOUT, "About", eMB_OK); } @@ -125,7 +117,7 @@ const char* QERPlug_GetCommandTitleList() } -#define NUM_TOOLBARBUTTONS 9 +#define NUM_TOOLBARBUTTONS 14 std::size_t ToolbarButtonCount( void ) { return NUM_TOOLBARBUTTONS; @@ -137,22 +129,30 @@ public: virtual const char* getImage() const { switch( mIndex ) { - case 0: return "bobtoolz_cleanup.bmp"; - case 1: return "bobtoolz_poly.bmp"; - case 2: return "bobtoolz_caulk.bmp"; - case 3: return "bobtoolz_treeplanter.bmp"; - case 4: return "bobtoolz_trainpathplot.bmp"; - case 5: return "bobtoolz_dropent.bmp"; - case 6: return "bobtoolz_merge.bmp"; - case 7: return "bobtoolz_split.bmp"; - case 8: return "bobtoolz_turnedge.bmp"; + case 0: return "bobtoolz_cleanup.bmp"; + case 1: return "bobtoolz_poly.bmp"; + case 2: return "bobtoolz_caulk.bmp"; + case 3: return ""; + case 4: return "bobtoolz_treeplanter.bmp"; + case 5: return "bobtoolz_trainpathplot.bmp"; + case 6: return "bobtoolz_dropent.bmp"; + case 7: return ""; + case 8: return "bobtoolz_merge.bmp"; + case 9: return "bobtoolz_split.bmp"; + case 10: return "bobtoolz_splitrow.bmp"; + case 11: return "bobtoolz_splitcol.bmp"; + case 12: return ""; + case 13: return "bobtoolz_turnedge.bmp"; } return NULL; } virtual EType getType() const { switch( mIndex ) { - case 3: return eToggleButton; + case 3: return eSpace; + case 4: return eToggleButton; + case 7: return eSpace; + case 12: return eSpace; default: return eButton; } } @@ -162,12 +162,14 @@ public: case 0: return "Cleanup"; case 1: return "Polygons"; case 2: return "Caulk"; - case 3: return "Tree Planter"; - case 4: return "Plot Splines"; - case 5: return "Drop Entity"; - case 6: return "Merge Patches"; - case 7: return "Split Patches"; - case 8: return "Flip Terrain"; + case 4: return "Tree Planter"; + case 5: return "Plot Splines"; + case 6: return "Drop Entity"; + case 8: return "Merge 2 Patches"; + case 9: return "Split Patch"; + case 10: return "Split Patch Rows"; + case 11: return "Split Patch Columns"; + case 13: return "Flip Terrain"; } return NULL; } @@ -177,12 +179,14 @@ public: case 0: return "Brush Cleanup"; case 1: return "Polygons"; case 2: return "Caulk selection"; - case 3: return "Tree Planter"; - case 4: return "Plot Splines"; - case 5: return "Drop Entity"; - case 6: return "Merge Patches"; - case 7: return "Split Patches"; - case 8: return "Flip Terrain"; + case 4: return "Tree Planter"; + case 5: return "Plot Splines"; + case 6: return "Drop Entity"; + case 8: return "Merge 2 Patches"; + case 9: return "Split Patch"; + case 10: return "Split Patch Rows"; + case 11: return "Split Patch Columns"; + case 13: return "Flip Terrain (Turn Edge)"; } return NULL; } @@ -195,12 +199,14 @@ public: case 0: DoFixBrushes(); break; case 1: DoPolygonsTB(); break; case 2: DoCaulkSelection(); break; - case 3: DoTreePlanter(); break; - case 4: DoTrainPathPlot(); break; - case 5: DoDropEnts(); break; - case 6: DoMergePatches(); break; - case 7: DoSplitPatch(); break; - case 8: DoFlipTerrain(); break; + case 4: DoTreePlanter(); break; + case 5: DoTrainPathPlot(); break; + case 6: DoDropEnts(); break; + case 8: DoMergePatches(); break; + case 9: DoSplitPatch(); break; + case 10: DoSplitPatchRows(); break; + case 11: DoSplitPatchCols(); break; + case 13: DoFlipTerrain(); break; } } @@ -259,7 +265,7 @@ class BobToolzPluginModule : public TypeSystemRef _QERPluginTable m_plugin; public: typedef _QERPluginTable Type; - STRING_CONSTANT(Name, "bobtoolz"); + STRING_CONSTANT(Name, "bobToolz"); BobToolzPluginModule() { @@ -291,7 +297,7 @@ class BobToolzToolbarDependencies : { public: BobToolzToolbarDependencies() : - ModuleRef<_QERPluginTable>("bobtoolz") + ModuleRef<_QERPluginTable>("bobToolz") { } }; @@ -301,7 +307,7 @@ class BobToolzToolbarModule : public TypeSystemRef _QERPlugToolbarTable m_table; public: typedef _QERPlugToolbarTable Type; - STRING_CONSTANT(Name, "bobtoolz"); + STRING_CONSTANT(Name, "bobToolz"); BobToolzToolbarModule() { diff --git a/contrib/bobtoolz/dialogs/dialogs-gtk.cpp b/contrib/bobtoolz/dialogs/dialogs-gtk.cpp index 15d9db67..927c7887 100644 --- a/contrib/bobtoolz/dialogs/dialogs-gtk.cpp +++ b/contrib/bobtoolz/dialogs/dialogs-gtk.cpp @@ -370,6 +370,7 @@ EMessageBoxReturn DoIntersectBox (IntersectRS* rs) // ---- vbox ---- + radio1 = gtk_radio_button_new_with_label(NULL, "Use Whole Map"); gtk_box_pack_start (GTK_BOX (vbox), radio1, FALSE, FALSE, 2); gtk_widget_show (radio1); @@ -377,7 +378,7 @@ EMessageBoxReturn DoIntersectBox (IntersectRS* rs) radio2 = gtk_radio_button_new_with_label(((GtkRadioButton*)radio1)->group, "Use Selected Brushes"); gtk_box_pack_start (GTK_BOX (vbox), radio2, FALSE, FALSE, 2); gtk_widget_show (radio2); - + w = gtk_hseparator_new (); gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 2); gtk_widget_show (w); @@ -1902,3 +1903,116 @@ EMessageBoxReturn DoTrainThingBox (TrainThingRS* rs) return ret; } +// ailmanki +// add a simple input for the MakeChain thing.. +EMessageBoxReturn DoMakeChainBox(MakeChainRS* rs) +{ + GtkWidget *window, *w, *vbox, *hbox; + GtkWidget *textlinkNum, *textlinkName; + EMessageBoxReturn ret; + int loop = 1; + + char *text = "Please set a value in the boxes below and press 'OK' to make a chain"; + + window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); + + gtk_signal_connect (GTK_OBJECT (window), "delete_event", GTK_SIGNAL_FUNC (dialog_delete_callback), NULL); + gtk_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC (gtk_widget_destroy), NULL); + + gtk_window_set_title( GTK_WINDOW( window ), "Make Chain" ); + + gtk_container_border_width( GTK_CONTAINER( window ), 10 ); + + g_object_set_data (G_OBJECT (window), "loop", &loop); + g_object_set_data (G_OBJECT (window), "ret", &ret); + + gtk_widget_realize (window); + + // new vbox + vbox = gtk_vbox_new( FALSE, 10 ); + gtk_container_add( GTK_CONTAINER( window ), vbox ); + gtk_widget_show( vbox ); + + hbox = gtk_hbox_new( FALSE, 10 ); + gtk_container_add( GTK_CONTAINER( vbox ), hbox ); + gtk_widget_show( hbox ); + + // dunno if you want this text or not ... + w = gtk_label_new( text ); + gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 0 ); + gtk_widget_show( w ); + + w = gtk_hseparator_new(); + gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 ); + gtk_widget_show( w ); + + // ------------------------- // + + // new hbox + hbox = gtk_hbox_new( FALSE, 10 ); + gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 ); + gtk_widget_show( hbox ); + + textlinkNum = gtk_entry_new_with_max_length( 256 ); + gtk_box_pack_start( GTK_BOX( hbox ), textlinkNum, FALSE, FALSE, 1 ); + gtk_widget_show( textlinkNum ); + + w = gtk_label_new( "Number of elements in chain" ); + gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 1 ); + gtk_widget_show( w ); + + // -------------------------- // + + hbox = gtk_hbox_new( FALSE, 10 ); + gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 ); + gtk_widget_show( hbox ); + + textlinkName = gtk_entry_new_with_max_length( 256 ); + gtk_box_pack_start( GTK_BOX( hbox ), textlinkName, FALSE, FALSE, 0 ); + gtk_widget_show( textlinkName ); + + w = gtk_label_new( "Basename for chain's targetnames." ); + gtk_box_pack_start( GTK_BOX( hbox ), w, FALSE, FALSE, 1 ); + gtk_widget_show( w ); + + + w = gtk_button_new_with_label( "OK" ); + gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0); + gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); + GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT ); + gtk_widget_grab_default( w ); + gtk_widget_show( w ); + + w = gtk_button_new_with_label( "Cancel" ); + gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); + gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDCANCEL ) ); + gtk_widget_show( w ); + + ret = eIDCANCEL; + + gtk_window_set_position(GTK_WINDOW(window),GTK_WIN_POS_CENTER); + gtk_widget_show (window); + gtk_grab_add (window); + + bool dialogError = TRUE; + while (dialogError) + { + loop = 1; + while (loop) + gtk_main_iteration (); + + dialogError = FALSE; + + if(ret == eIDOK) + { + strcpy(rs->linkName, gtk_entry_get_text((GtkEntry*)textlinkName)); + if(!ValidateTextInt(gtk_entry_get_text((GtkEntry*)textlinkNum), "Elements", &rs->linkNum)) + dialogError = TRUE; + } + } + + gtk_grab_remove (window); + gtk_widget_destroy (window); + + return ret; +} \ No newline at end of file diff --git a/contrib/bobtoolz/dialogs/dialogs-gtk.h b/contrib/bobtoolz/dialogs/dialogs-gtk.h index bcafdae8..0ad1c6b5 100644 --- a/contrib/bobtoolz/dialogs/dialogs-gtk.h +++ b/contrib/bobtoolz/dialogs/dialogs-gtk.h @@ -85,6 +85,11 @@ struct PathPlotterRS{ bool bShowExtra; }; +struct MakeChainRS{ + char linkName[256]; + int linkNum; +}; + typedef struct _GtkWidget GtkWidget; struct TwinWidget{ @@ -101,7 +106,7 @@ EMessageBoxReturn DoDoorsBox(DoorRS* rs); EMessageBoxReturn DoPathPlotterBox(PathPlotterRS* rs); EMessageBoxReturn DoCTFColourChangeBox(); EMessageBoxReturn DoTrainThingBox (TrainThingRS* rs); - +EMessageBoxReturn DoMakeChainBox(MakeChainRS* rs); //GtkWidget* GetProgressWindow(char* title, GtkProgressBar* feedback); #endif diff --git a/contrib/bobtoolz/funchandlers-GTK.cpp b/contrib/bobtoolz/funchandlers-GTK.cpp index 5d1f16a9..8f26d714 100644 --- a/contrib/bobtoolz/funchandlers-GTK.cpp +++ b/contrib/bobtoolz/funchandlers-GTK.cpp @@ -102,17 +102,19 @@ void DoIntersect() { if( GlobalSelectionSystem().countSelected() < 2 ) { - DoMessageBox("Invalid number of brushes selected, choose at least 2", "Error", eMB_OK); + //DoMessageBox("Invalid number of brushes selected, choose at least 2", "Error", eMB_OK); + globalErrorStream() << "bobToolz Intersect: Invalid number of brushes selected, choose at least 2.\n"; return; } } DEntity world; - switch(rs.nBrushOptions) { case BRUSH_OPT_SELECTED: { + + world.LoadFromEntity(GlobalRadiant().getMapWorldEntity(), false); world.LoadSelectedBrushes(); break; } @@ -122,7 +124,6 @@ void DoIntersect() break; } } - world.RemoveNonCheckBrushes(&exclusionList, rs.bUseDetail); bool* pbSelectList; @@ -132,7 +133,8 @@ void DoIntersect() pbSelectList = world.BuildIntersectList(); world.SelectBrushes(pbSelectList); - + int brushCount = GlobalSelectionSystem().countSelected(); + globalOutputStream() << "bobToolz Intersect: " << brushCount << " intersecting brushes found.\n"; delete[] pbSelectList; } @@ -147,12 +149,18 @@ void DoPolygons() // ensure we have something selected if( GlobalSelectionSystem().countSelected() != 1 ) { - DoMessageBox("Invalid number of brushes selected, choose 1 only", "Error", eMB_OK); + //DoMessageBox("Invalid number of brushes selected, choose 1 only", "Error", eMB_OK); + globalErrorStream() << "bobToolz Polygons: Invalid number of brushes selected, choose 1 only.\n"; return; } PolygonRS rs; - + scene::Instance& instance = GlobalSelectionSystem().ultimateSelected(); + if( !Node_isBrush(instance.path().top()) ) { + //DoMessageBox("No brush selected, select ONLY one brush", "Error", eMB_OK); + globalErrorStream() << "bobToolz Polygons: No brush selected, select ONLY one brush.\n"; + return; + } // ask user for type, size, etc.... if(DoPolygonBox(&rs) == eIDOK) { @@ -161,7 +169,7 @@ void DoPolygons() vec3_t vMin, vMax; { - scene::Instance& instance = GlobalSelectionSystem().ultimateSelected(); + VectorSubtract(instance.worldAABB().origin, instance.worldAABB().extents, vMin); VectorAdd(instance.worldAABB().origin, instance.worldAABB().extents, vMax); @@ -191,7 +199,7 @@ void DoFixBrushes() int count = world.FixBrushes(); - globalOutputStream() << count << " invalid/duplicate planes removed\n"; + globalOutputStream() << "bobToolz FixBrushes: " << count << " invalid/duplicate planes removed.\n"; } void DoResetTextures() @@ -243,7 +251,8 @@ void DoBuildStairs() // ensure we have something selected if( GlobalSelectionSystem().countSelected() != 1 ) { - DoMessageBox("Invalid number of brushes selected, choose 1 only", "Error", eMB_OK); + //DoMessageBox("Invalid number of brushes selected, choose 1 only", "Error", eMB_OK); + globalErrorStream() << "bobToolz BuildStairs: Invalid number of brushes selected, choose 1 only.\n"; return; } @@ -265,7 +274,8 @@ void DoBuildStairs() if(((int)size[2] % rs.stairHeight) != 0) { // stairs must fit evenly into brush - DoMessageBox("Invalid stair height\nHeight of block must be divisable by stair height", "Error", eMB_OK); + //DoMessageBox("Invalid stair height\nHeight of block must be divisable by stair height", "Error", eMB_OK); + globalErrorStream() << "bobToolz BuildStairs: Invalid stair height. Height of block must be divisable by stair height.\n"; } else { @@ -328,7 +338,8 @@ void DoBuildDoors() // ensure we have something selected if( GlobalSelectionSystem().countSelected() != 1 ) { - DoMessageBox("Invalid number of brushes selected, choose 1 only", "Error", eMB_OK); + //DoMessageBox("Invalid number of brushes selected, choose 1 only", "Error", eMB_OK); + globalErrorStream() << "bobToolz BuildDoors: Invalid number of brushes selected, choose 1 only.\n"; return; } @@ -369,88 +380,104 @@ void DoPathPlotter() } // ensure we have something selected - if( GlobalSelectionSystem().countSelected() != 1 ) + /* + if( GlobalSelectionSystem().countSelected() != 1 ) { - DoMessageBox("Invalid number of brushes selected, choose 1 only", "Error", eMB_OK); + //DoMessageBox("Invalid number of brushes selected, choose 1 only", "Error", eMB_OK); + globalOutputStream() << "bobToolz PathPlotter: Invalid number of entities selected, choose 1 trigger_push entity only.\n"; return; } - + */ Entity* entity = Node_getEntity(GlobalSelectionSystem().ultimateSelected().path().top()); if(entity != 0) { DBobView_setEntity(*entity, rs.fMultiplier, rs.nPoints, rs.fGravity, rs.bNoUpdate, rs.bShowExtra); - } + } + else globalErrorStream() << "bobToolz PathPlotter: No trigger_push entitity selected, select 1 only (Use list to select it).\n"; + return; } void DoPitBuilder() { - UndoableCommand undo("bobToolz.pitBuilder"); + UndoableCommand undo("bobToolz.pitBuilder"); // ensure we have something selected if( GlobalSelectionSystem().countSelected() != 1 ) { - DoMessageBox("Invalid number of brushes selected, choose 1 only", "Error", eMB_OK); + //DoMessageBox("Invalid number of brushes selected, choose 1 only", "Error", eMB_OK); + globalErrorStream() << "bobToolz PitBuilder: Invalid number of brushes selected, choose 1 only.\n"; return; } - vec3_t vMin, vMax; + vec3_t vMin, vMax; - scene::Instance& instance = GlobalSelectionSystem().ultimateSelected(); - VectorSubtract(instance.worldAABB().origin, instance.worldAABB().extents, vMin); - VectorAdd(instance.worldAABB().origin, instance.worldAABB().extents, vMax); + scene::Instance& instance = GlobalSelectionSystem().ultimateSelected(); + //seems it does this also with a patch with valid dimensions.. but probably better to enforce a brush. + if( !Node_isBrush(instance.path().top()) ) { + //DoMessageBox("No brush selected, select ONLY one brush", "Error", eMB_OK); + globalErrorStream() << "bobToolz PitBuilder: No brush selected, select ONLY 1 brush.\n"; + return; + } + + VectorSubtract(instance.worldAABB().origin, instance.worldAABB().extents, vMin); + VectorAdd(instance.worldAABB().origin, instance.worldAABB().extents, vMax); DShape pit; if(pit.BuildPit(vMin, vMax)) { pit.Commit(); - - Path_deleteTop(instance.path()); + Path_deleteTop(instance.path()); } else - DoMessageBox("Failed To Make Pit\nTry Making The Brush Bigger", "Error", eMB_OK); + { + //DoMessageBox("Failed To Make Pit\nTry Making The Brush Bigger", "Error", eMB_OK); + globalErrorStream() << "bobToolz PitBuilder: Failed to make Pit, try making the brush bigger.\n"; + } } void DoMergePatches() { - UndoableCommand undo("bobToolz.mergePatch"); - patch_merge_t merge_info; - DPatch mrgPatches[2]; - int i; + UndoableCommand undo("bobToolz.mergePatches"); + patch_merge_t merge_info; + DPatch mrgPatches[2]; + int i; // ensure we have something selected if( GlobalSelectionSystem().countSelected() != 2 ) { - DoMessageBox("Invalid number of patches selected, choose 2 only", "Error", eMB_OK); + globalErrorStream() << "bobToolz MergePatches: Invalid number of patches selected, choose 2 only.\n"; + //DoMessageBox("Invalid number of patches selected, choose 2 only", "Error", eMB_OK); return; } - scene::Instance* patches[2]; - patches[0] = &GlobalSelectionSystem().ultimateSelected(); - patches[1] = &GlobalSelectionSystem().penultimateSelected(); + scene::Instance* patches[2]; + patches[0] = &GlobalSelectionSystem().ultimateSelected(); + patches[1] = &GlobalSelectionSystem().penultimateSelected(); - for (i = 0; i < 2; i++) - { - if (!Node_isPatch(patches[i]->path().top())) - { - DoMessageBox("You must select ONLY patches", "Error", eMB_OK); - return; - } + for (i = 0; i < 2; i++) + { + if (!Node_isPatch(patches[i]->path().top())) + { + //DoMessageBox("No patches selected, select ONLY patches", "Error", eMB_OK); + globalErrorStream() << "bobToolz MergePatches: Invalid number of patches selected, choose ONLY 2 patches.\n"; + return; + } - mrgPatches[i].LoadFromPatch(*patches[i]); - } + mrgPatches[i].LoadFromPatch(*patches[i]); + } /* mrgPatches[0].Transpose(); mrgPatches[0].RemoveFromRadiant(); mrgPatches[0].BuildInRadiant();*/ - merge_info = mrgPatches[0].IsMergable(&mrgPatches[1]); + merge_info = mrgPatches[0].IsMergable(&mrgPatches[1]); - if (merge_info.mergable) - { - globalOutputStream() << merge_info.pos1 << " " << merge_info.pos2; - - globalOutputStream() << "Patches Mergable\n"; - DPatch* newPatch = mrgPatches[0].MergePatches(merge_info, &mrgPatches[0], &mrgPatches[1]); + if (merge_info.mergable) + { + globalOutputStream() << merge_info.pos1 << " " << merge_info.pos2; + //Message removed, No tools give feedback on success. + //globalOutputStream() << "bobToolz MergePatches: Patches Mergable.\n"; + DPatch* newPatch = mrgPatches[0].MergePatches(merge_info, &mrgPatches[0], &mrgPatches[1]); /* mrgPatches[0].RemoveFromRadiant(); mrgPatches[0].BuildInRadiant(); @@ -461,21 +488,22 @@ void DoMergePatches() delete newPatch;*/ - if (!newPatch) - { - } else - { - Path_deleteTop(patches[0]->path()); - Path_deleteTop(patches[1]->path()); + if (!newPatch) + { + } else + { + Path_deleteTop(patches[0]->path()); + Path_deleteTop(patches[1]->path()); - newPatch->BuildInRadiant(); - delete newPatch; - } - } - else - { - globalOutputStream() << "bobToolz.mergePatch: the selected patches are not mergable\n"; - } + newPatch->BuildInRadiant(); + delete newPatch; + } + } + else + { + globalErrorStream() << "bobToolz.mergePatch: The selected patches are not mergable.\n"; + + } } void DoSplitPatch() { @@ -486,24 +514,88 @@ void DoSplitPatch() { // ensure we have something selected if( GlobalSelectionSystem().countSelected() != 1 ) { - DoMessageBox("Invalid number of patches selected, choose 1 only", "Error", eMB_OK); + //DoMessageBox("Invalid number of patches selected, choose 1 only", "Error", eMB_OK); + globalErrorStream() << "bobToolz SplitPatch: Invalid number of patches selected, choose only 1 patch.\n"; return; } scene::Instance& instance = GlobalSelectionSystem().ultimateSelected(); if( !Node_isPatch(instance.path().top()) ) { - DoMessageBox("You must select ONLY patches", "Error", eMB_OK); + //DoMessageBox("No patch selected, select ONLY one patch", "Error", eMB_OK); + globalErrorStream() << "bobToolz SplitPatch: No patch selected, select ONLY 1 patch.\n"; return; } 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(); + } + + 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); + globalErrorStream() << "bobToolz SplitPatchCols: Invalid number of patches selected, choose 1 only.\n"; + return; + } + + scene::Instance& instance = GlobalSelectionSystem().ultimateSelected(); + + if( !Node_isPatch(instance.path().top()) ) { + //DoMessageBox("No patch selected, select ONLY one patch", "Error", eMB_OK); + globalErrorStream() << "bobToolz SplitPatchCols: No patch selected, select ONLY 1 patch.\n"; + 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); + globalErrorStream() << "bobToolz SplitPatchRows: Invalid number of patches selected, choose 1 only.\n"; + return; + } + + scene::Instance& instance = GlobalSelectionSystem().ultimateSelected(); + + if( !Node_isPatch(instance.path().top()) ) { + //DoMessageBox("No patch selected, select ONLY one patch", "Error", eMB_OK); + globalErrorStream() << "bobToolz SplitPatchRows: No patch selected, select ONLY 1 patch.\n"; + 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()); } @@ -513,6 +605,7 @@ void DoVisAnalyse() if( GlobalSelectionSystem().countSelected() == 0 ) { + globalErrorStream() << "bobToolz VisAnalyse: Invalid number of objects selected, choose 1 only.\n"; if(g_VisView) { delete g_VisView; @@ -523,12 +616,18 @@ void DoVisAnalyse() // ensure we have something selected if( GlobalSelectionSystem().countSelected() != 1 ) { - DoMessageBox("Invalid number of objects selected, choose 1 only", "Error", eMB_OK); + //DoMessageBox("Invalid number of objects selected, choose 1 only", "Error", eMB_OK); + globalErrorStream() << "bobToolz VisAnalyse: Invalid number of objects selected, choose 1 only.\n"; + return; + } + + scene::Instance& brush = GlobalSelectionSystem().ultimateSelected(); + //ensure we have a brush selected + if( !Node_isBrush(brush.path().top()) ) { + //DoMessageBox("No brush selected, select ONLY one brush", "Error", eMB_OK); + globalErrorStream() << "bobToolz VisAnalyse: No brush selected, select ONLY 1 brush.\n"; return; } - - scene::Instance& brush = GlobalSelectionSystem().ultimateSelected(); - DBrush orgBrush; orgBrush.LoadFromBrush(brush, false); @@ -542,7 +641,8 @@ void DoVisAnalyse() const char* rad_filename = GlobalRadiant().getMapName(); if(!rad_filename) { - DoMessageBox("An Error Occurred While Trying\n To Get The Map Filename", "Error", eMB_OK); + //DoMessageBox("An ERROR occurred while trying\n to get the map filename", "Error", eMB_OK); + globalErrorStream() << "bobToolz VisAnalyse: An ERROR occurred while trying to get the map filename.\n"; return; } @@ -604,9 +704,17 @@ void DoDropEnts() { } void DoMakeChain() { - UndoableCommand undo("bobToolz.makeChain"); - DTreePlanter pl; - pl.MakeChain(); + MakeChainRS rs; + if(DoMakeChainBox(&rs) == eIDOK) + { + if ( rs.linkNum > 1001 ) { + globalErrorStream() << "bobToolz MakeChain: " << rs.linkNum << " to many Elemets, limited to 1000.\n"; + return; + } + UndoableCommand undo("bobToolz.makeChain"); + DTreePlanter pl; + pl.MakeChain(rs.linkNum,rs.linkName); + } } typedef DPoint* pntTripple[3]; @@ -621,21 +729,31 @@ void DoFlipTerrain() { // ensure we have something selected if( GlobalSelectionSystem().countSelected() != 2 ) { - DoMessageBox("Invalid number of objects selected, choose 2 only", "Error", eMB_OK); + //DoMessageBox("Invalid number of objects selected, choose 2 only", "Error", eMB_OK); + globalErrorStream() << "bobToolz FlipTerrain: Invalid number of objects selected, choose 2 only.\n"; return; } scene::Instance* brushes[2]; brushes[0] = &GlobalSelectionSystem().ultimateSelected(); brushes[1] = &GlobalSelectionSystem().penultimateSelected(); - + //ensure we have only Brushes selected. + for (i = 0; i < 2; i++) + { + if( !Node_isBrush(brushes[i]->path().top()) ) { + //DoMessageBox("No brushes selected, select ONLY brushes", "Error", eMB_OK); + globalErrorStream() << "bobToolz FlipTerrain: No brushes selected, select ONLY 2 brushes.\n"; + return; + } + } DBrush Brushes[2]; DPlane* Planes[2]; pntTripple Points[2]; for( i = 0; i < 2; i++ ) { Brushes[i].LoadFromBrush( *brushes[i], false ); if(!(Planes[i] = Brushes[i].FindPlaneWithClosestNormal( vUp )) || Brushes[i].FindPointsForPlane( Planes[i], Points[i], 3 ) != 3) { - DoMessageBox("Error", "Error", eMB_OK); + //DoMessageBox("Error", "Error", eMB_OK); + globalErrorStream() << "bobToolz FlipTerrain: ERROR (FindPlaneWithClosestNormal/FindPointsForPlane).\n"; return; } } @@ -662,7 +780,8 @@ void DoFlipTerrain() { found = false; } if(dontmatch[0] == -1) { - DoMessageBox("Error", "Error", eMB_OK); + //DoMessageBox("Error", "Error", eMB_OK); + globalErrorStream() << "bobToolz FlipTerrain: ERROR (dontmatch[0]).\n"; return; } @@ -680,7 +799,8 @@ void DoFlipTerrain() { found = false; } if(dontmatch[1] == -1) { - DoMessageBox("Error", "Error", eMB_OK); + //DoMessageBox("Error", "Error", eMB_OK); + globalErrorStream() << "bobToolz FlipTerrain: ERROR (dontmatch[1]).\n"; return; } 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/contrib/bobtoolz/shapes.cpp b/contrib/bobtoolz/shapes.cpp index 4713ff5f..e38dd495 100644 --- a/contrib/bobtoolz/shapes.cpp +++ b/contrib/bobtoolz/shapes.cpp @@ -576,32 +576,43 @@ void BuildDoorsX2(vec3_t min, vec3_t max, void MakeBevel(vec3_t vMin, vec3_t vMax) { - NodeSmartReference patch(GlobalPatchCreator().createPatch()); - PatchControlMatrix matrix = GlobalPatchCreator().Patch_getControlPoints(patch); - - GlobalPatchCreator().Patch_setShader(patch, "textures/common/caulk"); - GlobalPatchCreator().Patch_resize(patch, 3, 3); - + NodeSmartReference patch(GlobalPatchCreator().createPatch()); + GlobalPatchCreator().Patch_resize(patch, 3, 3); + GlobalPatchCreator().Patch_setShader(patch, "textures/common/caulk"); + PatchControlMatrix matrix = GlobalPatchCreator().Patch_getControlPoints(patch); vec3_t x_3, y_3, z_3; x_3[0] = vMin[0]; x_3[1] = vMin[0]; x_3[2] = vMax[0]; y_3[0] = vMin[1]; y_3[1] = vMax[1]; y_3[2] = vMax[1]; z_3[0] = vMin[2]; z_3[1] = (vMax[2] + vMin[2])/2; z_3[2] = vMax[2]; - -/* x_3[0] = 0; x_3[1] = 0; x_3[2] = 64; - y_3[0] = 0; y_3[1] = 64; y_3[2] = 64; - z_3[0] = 0; z_3[1] = 32; z_3[2] = 64;*/ - + /* + x_3[0] = 0; x_3[1] = 0; x_3[2] = 64; + y_3[0] = 0; y_3[1] = 64; y_3[2] = 64; + z_3[0] = 0; z_3[1] = 32; z_3[2] = 64;*/ for(int i = 0; i < 3; i++) { for(int j = 0; j < 3; j++) { - matrix(i, j).m_vertex[0] = x_3[i]; - matrix(i, j).m_vertex[1] = y_3[i]; - matrix(i, j).m_vertex[2] = z_3[j]; + PatchControl& p = matrix(i, j); + p.m_vertex[0] = x_3[i]; + p.m_vertex[1] = y_3[i]; + p.m_vertex[2] = z_3[j]; } } - - Node_getTraversable(GlobalRadiant().getMapWorldEntity())->insert(patch); + //does invert the matrix, else the patch face is on wrong side. + for(int i = 0 ; i < 3 ; i++ ) + { + for(int j = 0; j < 1; j++) + { + PatchControl& p = matrix(i,2- j); + PatchControl& q = matrix(i, j); + std::swap(p.m_vertex, q.m_vertex); + //std::swap(p.m_texcoord, q.m_texcoord); + } + } + GlobalPatchCreator().Patch_controlPointsChanged(patch); + //TODO - the patch has textures weird, patchmanip.h has all function it needs.. lots of duplicate code.. + //NaturalTexture(patch); + Node_getTraversable(GlobalRadiant().getMapWorldEntity())->insert(patch); } void BuildCornerStairs(vec3_t vMin, vec3_t vMax, int nSteps, const char* mainTexture, const char* riserTex) @@ -609,7 +620,7 @@ void BuildCornerStairs(vec3_t vMin, vec3_t vMax, int nSteps, const char* mainTex vec3_t* topPoints = new vec3_t[nSteps+1]; vec3_t* botPoints = new vec3_t[nSteps+1]; - bool bFacesUse[6] = {true, true, false, true, false, false}; + //bool bFacesUse[6] = {true, true, false, true, false, false}; vec3_t centre; VectorCopy(vMin, centre); @@ -644,8 +655,25 @@ void BuildCornerStairs(vec3_t vMin, vec3_t vMax, int nSteps, const char* mainTex for(i = 0; i < nSteps; i++) { - scene::Node& brush = Build_Get_BoundingCube_Selective(vBot, vTop, "textures/common/caulk", bFacesUse); - + NodeSmartReference brush(GlobalBrushCreator().createBrush()); + vec3_t v1, v2, v3, v5, v6, v7; + VectorCopy(vBot, v1); + VectorCopy(vBot, v2); + VectorCopy(vBot, v3); + VectorCopy(vTop, v5); + VectorCopy(vTop, v6); + VectorCopy(vTop, v7); + + v2[0] = vTop[0]; + v3[1] = vTop[1]; + + v6[0] = vBot[0]; + v7[1] = vBot[1]; + + AddFaceWithTexture(brush, v1, v2, v3, "textures/common/caulk", false); + AddFaceWithTexture(brush, v1, v3, v6, "textures/common/caulk", false); + AddFaceWithTexture(brush, v5, v6, v3, "textures/common/caulk", false); + for(int j = 0; j < 3; j++) tp[j][2] = vTop[2]; diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 00000000..45a168ec --- /dev/null +++ b/docs/index.html @@ -0,0 +1,16 @@ + + + + + + + + + + + +

put here links

+ + diff --git a/include/igl.h b/include/igl.h index b1753457..0662379e 100644 --- a/include/igl.h +++ b/include/igl.h @@ -2318,8 +2318,14 @@ struct OpenGLBinding void (QGL_DLLEXPORT *m_glTexGenfv)(GLenum coord, GLenum pname, const GLfloat *params); void (QGL_DLLEXPORT *m_glTexGeni)(GLenum coord, GLenum pname, GLint param); void (QGL_DLLEXPORT *m_glTexGeniv)(GLenum coord, GLenum pname, const GLint *params); +#if defined(MACVERSION) && MACVERSION > 15 + //Snow Leopard 16, Leopard 15, Tiger 14, Panther 13, ... + void (QGL_DLLEXPORT *m_glTexImage1D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels); + void (QGL_DLLEXPORT *m_glTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +#else void (QGL_DLLEXPORT *m_glTexImage1D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels); - void (QGL_DLLEXPORT *m_glTexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); + void (QGL_DLLEXPORT *m_glTexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +#endif void (QGL_DLLEXPORT *m_glTexParameterf)(GLenum target, GLenum pname, GLfloat param); void (QGL_DLLEXPORT *m_glTexParameterfv)(GLenum target, GLenum pname, const GLfloat *params); void (QGL_DLLEXPORT *m_glTexParameteri)(GLenum target, GLenum pname, GLint param); diff --git a/install-dylibs.sh b/install-dylibs.sh index 107e477d..fd70339a 100644 --- a/install-dylibs.sh +++ b/install-dylibs.sh @@ -5,10 +5,14 @@ set -ex : ${OTOOL:=otool} : ${CP:=cp} : ${INSTALLDIR:=.} +: ${EXE:=ppc} +: ${MACLIBDIR:=/sw/lib} +: ${CAT:=cat} + 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,23 +20,50 @@ 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" finkgetdeps "$LAST" + +cp -L "$MACLIBDIR"/../etc/fonts/fonts.conf "$INSTALLDIR" +cp -L "$MACLIBDIR"/../etc/fonts/fonts.dtd "$INSTALLDIR" +cp -L "$MACLIBDIR"/../etc/gtk-2.0/gdk-pixbuf.loaders "$INSTALLDIR" +cp -L "$MACLIBDIR"/../etc/pango/pangorc "$INSTALLDIR" + +$CAT > $INSTALLDIR/../netradiant.sh <m_selectable.isSelected(); + } + */ + for(std::size_t w = 0; w != width; ++w, p1 += col_stride) { { PatchControl* p2 = p1; @@ -831,7 +839,15 @@ void Patch::InsertPoints(EMatrixMajor mt, bool bFirst) ERROR_MESSAGE("neither row-major nor column-major"); return; } - + if(bFirst) + { + pos = height - 1; + } + else + { + pos = 2; + } + if(pos >= height) { if(bFirst) @@ -978,7 +994,14 @@ void Patch::RemovePoints(EMatrixMajor mt, bool bFirst) ERROR_MESSAGE("neither row-major nor column-major"); return; } - + if(bFirst) + { + pos=height-3; + } + else + { + pos=2; + } if(pos >= height) { if(bFirst) 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..f4982522 100755 --- a/setup/data/osx/NetRadiant.app/Contents/MacOS/netradiant.sh +++ b/setup/data/osx/NetRadiant.app/Contents/MacOS/netradiant.sh @@ -1,16 +1 @@ -#!/bin/sh - -MY_DIRECTORY="${0%/*}" # cut off the script name -MY_DIRECTORY="${MY_DIRECTORY%/*}" # cut off MacOS -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" - -cd "$MY_DIRECTORY/Contents/MacOS/install" -if [ -x /usr/bin/open-x11 ]; then - /usr/bin/open-x11 ./radiant.ppc "$@" & -else - ./radiant.ppc "$@" & -fi +dummy for correct execute rights \ No newline at end of file diff --git a/setup/data/tools/plugins/bitmaps/bobtoolz_cleanup.bmp b/setup/data/tools/plugins/bitmaps/bobtoolz_cleanup.bmp index 33cc9490f08d5987542b82cc6e8e51ee6d2d8f05..8939d5d72a8a982bfd9d7fbbe7c61346f14194c2 100644 GIT binary patch literal 1318 zcmZ?rRbyoU12Yx|1`Qxf0Ej>S|Noznfde7|B!#&l7$)$a;XgxXBm=|awbBd>!3+$n zQ}|(0qx5J9jE2B)4*^Cn0Q!=dnHlU?MkXdEMj)4kg#|2t#0Lq0xFC6$0^g{pp!S2DhwMHCALv4;^C9v;CxaXV0So{fO$>Yh literal 316 zcmZ?rwP9oc11}({0mK48%n!tj3>-ib0))637(kd6$OYm5K=^pAGz04teun@5|3g(_ zQedN*KmaVq$OsZZ=A!dK%9ubZfHXukSOkp^QGk#qjt@2v?jncu4 z1%a^)Uk83x?I_Vp=P%~v1>A*v+ zQ)*zAUT!&XQ*F7o7{TgkAP O)&Ebeo`0-S|Noznfde7|B!#&l7$)$a;XlKK2@_!4QF=54Mnhnv zg#Z%*fV|Gc2nS4PTp%AwmXV1Gl?xO=kp}WX2nv7-ib0))637(kc}$OYm5K==m;e*&Q$5Q4z}|Np@> z7J>yuj0FVXA`muQ1TF(*ASncEp_mUffDvX9&}JqE1{P){gMmT_9>`Wy9^C051^~OX B3%~#X diff --git a/setup/data/tools/plugins/bitmaps/bobtoolz_split.bmp b/setup/data/tools/plugins/bitmaps/bobtoolz_split.bmp index fbb1571ce1c870ddc44f5aa9eaa6106ba261274d..7e1dc72f60bf4597f0009d64b79834727f906932 100644 GIT binary patch literal 1334 zcmeHD+X;X$3`~Q9;E&)EPS64TcPB@7gLv08P`~|6;M#k%X~}ujSz6Ue z9$?*9M;In1asyd8ft)~2K*te4=wOg*2}ePx3mnBc64xY@)IoYIev&yaA#R}C`Op6B O;_tJgm;W!+XMX{&1qr$U literal 312 zcmaKmF%p0v3!zxzy&rTA=|MU!gl(Fny8U7^z^_* z%|lYhyL5BO11D9?0q$ySoO>(g0()P$CAL)JRyYF0ml+UNw!nsY{p9&u%P~={57a0z MPcva~&g%H%2bECS|Noznfde7|B!#&l7$)$a;XeaI0}zjb(GVC7fzc3P i0s#gH2@VY=Mn*=U0GPxoK(YdK4J7gjC`Xe<^A7;ah6$|z literal 0 HcmV?d00001 diff --git a/setup/data/tools/plugins/bitmaps/bobtoolz_splitrow.bmp b/setup/data/tools/plugins/bitmaps/bobtoolz_splitrow.bmp new file mode 100644 index 0000000000000000000000000000000000000000..03b1ae3abf7562846d6d0ac46d9f303d434a4237 GIT binary patch literal 1318 zcmeHDK?;B{4C{)5;6?Bc;tPC$cmL#!vJ#?}d~ literal 0 HcmV?d00001 diff --git a/setup/data/tools/plugins/bitmaps/bobtoolz_treeplanter.bmp b/setup/data/tools/plugins/bitmaps/bobtoolz_treeplanter.bmp index 08f55f3cf428b9ee20f257ca43797db5d55b91a9..5c967ab24a0bf9a10683baa34367265c5ed2d3d9 100644 GIT binary patch literal 1318 zcmeHDOA5k341E;^NmD5F4&n*Kg)8^=4ldeTdk7b98()$c(1jO}4kUe_yfTyP?XW|f z(-t@q^{l6vHQ1-YKD1d?Fc@H77fNJ=A(esVwP1N{Fwej=0pr+XINv$vgX>v0ux{W_ zHX!o-5D|5us-l|QKNNp(rrcLZ<}24S@0_O6X3O8Gv>JY<+$%f~v5$70-^Sw~90-;9 OxLm# z5eK4R&knqaV-t`rEIe3*YcO72;!u^(jQO?0Gy&rX3`2+0<<5wVf2(b`vYFLdQ{l>* xmHUd#5D|IZuZS_@lm2`{0gCR^ljLrayy2m{puJmsuY1Vrk5Y)4{pU-X^9x&$8s7i_ -- 2.39.2