From 72a0fb0963885ee0793854d84e79f272bd4f4f5f Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Mon, 7 Sep 2009 17:01:47 -0700 Subject: Fixed tool brush size --- linden/indra/newview/app_settings/settings.xml | 2 +- linden/indra/newview/llfloatertools.cpp | 2 +- linden/indra/newview/lltoolbrush.cpp | 45 +++++++++++++++++++------- linden/indra/newview/lltoolbrush.h | 5 ++- linden/scripts/messages/message_template.msg | 10 ++++-- 5 files changed, 46 insertions(+), 18 deletions(-) (limited to 'linden') diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml index a080be2..a6a18e6 100644 --- a/linden/indra/newview/app_settings/settings.xml +++ b/linden/indra/newview/app_settings/settings.xml @@ -5791,7 +5791,7 @@ Persist 1 Type - S32 + F32 Value 0 diff --git a/linden/indra/newview/llfloatertools.cpp b/linden/indra/newview/llfloatertools.cpp index f3ffbe4..b63138f 100644 --- a/linden/indra/newview/llfloatertools.cpp +++ b/linden/indra/newview/llfloatertools.cpp @@ -322,7 +322,7 @@ BOOL LLFloaterTools::postBuild() mSliderDozerSize = getChild("slider brush size"); childSetCommitCallback("slider brush size", commit_slider_dozer_size, (void*)0); - childSetValue( "slider brush size", gSavedSettings.getS32("LandBrushSize")); + childSetValue( "slider brush size", gSavedSettings.getF32("LandBrushSize")); mSliderDozerForce = getChild("slider force"); diff --git a/linden/indra/newview/lltoolbrush.cpp b/linden/indra/newview/lltoolbrush.cpp index 46b36d9..d23e29d 100644 --- a/linden/indra/newview/lltoolbrush.cpp +++ b/linden/indra/newview/lltoolbrush.cpp @@ -96,7 +96,24 @@ LLToolBrushLand::LLToolBrushLand() mGotHover(FALSE), mBrushSelected(FALSE) { - mBrushIndex = gSavedSettings.getS32("LandBrushSize"); + mBrushSize = gSavedSettings.getF32("LandBrushSize"); +} + + +U8 LLToolBrushLand::getBrushIndex() +{ + // find the best index for desired size + // (compatibility with old sims, brush_index is now depricated - DEV-8252) + U8 index = 0; + for (U8 i = 0; i < LAND_BRUSH_SIZE_COUNT; i++) + { + if (mBrushSize > LAND_BRUSH_SIZE[i]) + { + index = i; + } + } + + return index; } void LLToolBrushLand::modifyLandAtPointGlobal(const LLVector3d &pos_global, @@ -157,7 +174,6 @@ void LLToolBrushLand::modifyLandAtPointGlobal(const LLVector3d &pos_global, F32 seconds = (1.0f / gFPSClamped) * gSavedSettings.getF32("LandBrushForce"); F32 x_pos = (F32)pos_region.mV[VX]; F32 y_pos = (F32)pos_region.mV[VY]; - U8 brush_size = (U8)mBrushIndex; LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ModifyLand); msg->nextBlockFast(_PREHASH_AgentData); @@ -165,7 +181,7 @@ void LLToolBrushLand::modifyLandAtPointGlobal(const LLVector3d &pos_global, msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ModifyBlock); msg->addU8Fast(_PREHASH_Action, (U8)action); - msg->addU8Fast(_PREHASH_BrushSize, brush_size); + msg->addU8Fast(_PREHASH_BrushSize, getBrushIndex()); msg->addF32Fast(_PREHASH_Seconds, seconds); msg->addF32Fast(_PREHASH_Height, mStartingZ); msg->nextBlockFast(_PREHASH_ParcelData); @@ -174,6 +190,8 @@ void LLToolBrushLand::modifyLandAtPointGlobal(const LLVector3d &pos_global, msg->addF32Fast(_PREHASH_South, y_pos ); msg->addF32Fast(_PREHASH_East, x_pos ); msg->addF32Fast(_PREHASH_North, y_pos ); + msg->nextBlock("ModifyBlockExtended"); + msg->addF32("BrushSize", mBrushSize); msg->sendMessage(regionp->getHost()); } } @@ -294,7 +312,6 @@ void LLToolBrushLand::modifyLandInSelectionGlobal() regionp->forceUpdate(); // tell the simulator what we've done - U8 brush_size = (U8)mBrushIndex; LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ModifyLand); msg->nextBlockFast(_PREHASH_AgentData); @@ -302,7 +319,7 @@ void LLToolBrushLand::modifyLandInSelectionGlobal() msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ModifyBlock); msg->addU8Fast(_PREHASH_Action, (U8)action); - msg->addU8Fast(_PREHASH_BrushSize, brush_size); + msg->addU8Fast(_PREHASH_BrushSize, getBrushIndex()); msg->addF32Fast(_PREHASH_Seconds, seconds); msg->addF32Fast(_PREHASH_Height, mStartingZ); @@ -327,6 +344,9 @@ void LLToolBrushLand::modifyLandInSelectionGlobal() msg->addF32Fast(_PREHASH_East, max_region.mV[VX] ); msg->addF32Fast(_PREHASH_North, max_region.mV[VY] ); } + + msg->nextBlock("ModifyBlockExtended"); + msg->addF32("BrushSize", mBrushSize); msg->sendMessage(regionp->getHost()); } @@ -447,7 +467,8 @@ void LLToolBrushLand::render() spot.mdV[VX] = floor( spot.mdV[VX] + 0.5 ); spot.mdV[VY] = floor( spot.mdV[VY] + 0.5 ); - mBrushIndex = gSavedSettings.getS32("LandBrushSize"); + mBrushSize = gSavedSettings.getF32("LandBrushSize"); + region_list_t regions; determineAffectedRegions(regions, spot); @@ -499,7 +520,7 @@ void LLToolBrushLand::renderOverlay(LLSurface& land, const LLVector3& pos_region S32 i = (S32) pos_region.mV[VX]; S32 j = (S32) pos_region.mV[VY]; - S32 half_edge = llfloor(LAND_BRUSH_SIZE[mBrushIndex]); + S32 half_edge = llfloor(mBrushSize); S32 radioAction = gSavedSettings.getS32("RadioLandBrushAction"); F32 force = gSavedSettings.getF32("LandBrushForce"); // .1 to 100? @@ -556,27 +577,27 @@ void LLToolBrushLand::determineAffectedRegions(region_list_t& regions, const LLVector3d& spot ) const { LLVector3d corner(spot); - corner.mdV[VX] -= (LAND_BRUSH_SIZE[mBrushIndex] / 2); - corner.mdV[VY] -= (LAND_BRUSH_SIZE[mBrushIndex] / 2); + corner.mdV[VX] -= (mBrushSize / 2); + corner.mdV[VY] -= (mBrushSize / 2); LLViewerRegion* region = NULL; region = LLWorld::getInstance()->getRegionFromPosGlobal(corner); if(region && regions.find(region) == regions.end()) { regions.insert(region); } - corner.mdV[VY] += LAND_BRUSH_SIZE[mBrushIndex]; + corner.mdV[VY] += mBrushSize; region = LLWorld::getInstance()->getRegionFromPosGlobal(corner); if(region && regions.find(region) == regions.end()) { regions.insert(region); } - corner.mdV[VX] += LAND_BRUSH_SIZE[mBrushIndex]; + corner.mdV[VX] += mBrushSize; region = LLWorld::getInstance()->getRegionFromPosGlobal(corner); if(region && regions.find(region) == regions.end()) { regions.insert(region); } - corner.mdV[VY] -= LAND_BRUSH_SIZE[mBrushIndex]; + corner.mdV[VY] -= mBrushSize; region = LLWorld::getInstance()->getRegionFromPosGlobal(corner); if(region && regions.find(region) == regions.end()) { diff --git a/linden/indra/newview/lltoolbrush.h b/linden/indra/newview/lltoolbrush.h index 8df4b67..f25d6b9 100644 --- a/linden/indra/newview/lltoolbrush.h +++ b/linden/indra/newview/lltoolbrush.h @@ -95,11 +95,14 @@ protected: F32 mStartingZ; S32 mMouseX; S32 mMouseY; - S32 mBrushIndex; + F32 mBrushSize; BOOL mGotHover; BOOL mBrushSelected; // Order doesn't matter and we do check for existance of regions, so use a set region_list_t mLastAffectedRegions; + +private: + U8 getBrushIndex(); }; diff --git a/linden/scripts/messages/message_template.msg b/linden/scripts/messages/message_template.msg index 6d90622..4a16cf8 100644 --- a/linden/scripts/messages/message_template.msg +++ b/linden/scripts/messages/message_template.msg @@ -594,7 +594,7 @@ version 2.0 // global x,y,z. Otherwise, use center of the AABB. // reliable { - PlacesReply Low 30 Trusted Zerocoded + PlacesReply Low 30 Trusted Zerocoded UDPDeprecated { AgentData Single { AgentID LLUUID } @@ -1036,7 +1036,7 @@ version 2.0 // dataserver -> simulator -> viewer // reliable { - DirLandReply Low 50 Trusted Zerocoded + DirLandReply Low 50 Trusted Zerocoded UDPDeprecated { AgentData Single { AgentID LLUUID } @@ -2589,6 +2589,10 @@ version 2.0 { East F32 } { North F32 } } + { + ModifyBlockExtended Variable + { BrushSize F32 } + } } @@ -8717,7 +8721,7 @@ version 2.0 // spaceserver -> simulator { - RpcScriptRequestInboundForward Low 416 Trusted Unencoded + RpcScriptRequestInboundForward Low 416 Trusted Unencoded UDPDeprecated { DataBlock Single { RPCServerIP IPADDR } -- cgit v1.1