{
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;
}
break;
}
}
-
world.RemoveNonCheckBrushes(&exclusionList, rs.bUseDetail);
bool* pbSelectList;
pbSelectList = world.BuildIntersectList();
world.SelectBrushes(pbSelectList);
-
+ int brushCount = GlobalSelectionSystem().countSelected();
+ globalOutputStream() << "bobToolz Intersect: " << brushCount << " intersecting brushes found.\n";
delete[] pbSelectList;
}
// 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)
{
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);
int count = world.FixBrushes();
- globalOutputStream() << count << " invalid/duplicate planes removed\n";
+ globalOutputStream() << "bobToolz FixBrushes: " << count << " invalid/duplicate planes removed.\n";
}
void DoResetTextures()
// 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;
}
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
{
// 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;
}
}
// 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]);
-
- if (merge_info.mergable)
- {
- globalOutputStream() << merge_info.pos1 << " " << merge_info.pos2;
+ merge_info = mrgPatches[0].IsMergable(&mrgPatches[1]);
- 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();
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() {
// 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;
}
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<DPatch> patchList = patch.SplitCols();
+ for(std::list<DPatch>::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<DPatch> patchList = patch.SplitRows();
+ for(std::list<DPatch>::iterator patches = patchList.begin(); patches != patchList.end(); patches++) {
+ (*patches).BuildInRadiant();
+ }
+
+ Path_deleteTop(instance.path());
+}
+
void DoSplitPatchCols() {
UndoableCommand undo("bobToolz.splitPatchCols");
if( GlobalSelectionSystem().countSelected() == 0 )
{
+ globalErrorStream() << "bobToolz VisAnalyse: Invalid number of objects selected, choose 1 only.\n";
if(g_VisView)
{
delete g_VisView;
// 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);
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;
}
}
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];
// 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;
}
}
found = false;
}
if(dontmatch[0] == -1) {
- DoMessageBox("Error", "Error", eMB_OK);
+ //DoMessageBox("Error", "Error", eMB_OK);
+ globalErrorStream() << "bobToolz FlipTerrain: ERROR (dontmatch[0]).\n";
return;
}
found = false;
}
if(dontmatch[1] == -1) {
- DoMessageBox("Error", "Error", eMB_OK);
+ //DoMessageBox("Error", "Error", eMB_OK);
+ globalErrorStream() << "bobToolz FlipTerrain: ERROR (dontmatch[1]).\n";
return;
}